public AdSession updateAdSession(AdSession session, Map<String, Object> body) throws AdValidationException {
        session.setAuthenticationLevel((Integer) body.get("authentication_level"));
        session.setAuthenticationStatus((String) body.get("authentication_status"));
        session.setBsn((String) body.get("bsn"));
        session.setPolymorphIdentity(valueToStringOrNull(body, "polymorph_identity"));
        session.setPolymorphPseudonym(valueToStringOrNull(body, "polymorph_pseudonym"));

        BeanPropertyBindingResult result = new BeanPropertyBindingResult(session, "adSession");
        ValidationUtils.invokeValidator(new AdSessionValidator(), session, result);
        if (result.hasErrors()) {
            throw new AdValidationException("AdSession validation error", result);
        }

        adSessionRepository.save(session);

        return session;
    }
@Test
    public void updateAdSessionInvalid() {
        HashMap<String, Object> body = new HashMap<>();
        body.put("authentication_level", 1);
        body.put("authentication_status", "Pending");
        body.put("bsn", "PPPPPPP");

        AdValidationException exception = assertThrows(AdValidationException.class, () -> adService.updateAdSession(new AdSession(), body));

        assertEquals("AdSession validation error", exception.getLocalizedMessage());
        assertEquals(3, exception.getDetails().getErrorCount());
    }