@Test public void testValidationOfPersonnummerDoesNotExistInPU() { when(patientDetailsResolver.getPersonFromPUService(any(Personnummer.class))) .thenReturn(PersonSvar.notFound()); ResultValidator result = validator.validateApplicationErrors(buildIntyg(TSBAS, "efternamn", "förnamn", "fullständigt namn", "enhetsId", "enhetsnamn", true), user); assertTrue(result.hasErrors()); verify(patientDetailsResolver).getPersonFromPUService(any(Personnummer.class)); }
@Override public ResultValidator validateApplicationErrors(Intyg intyg, IntygUser user) { ResultValidator errors = ResultValidator.newInstance(); String personId = intyg.getPatient().getPersonId().getExtension(); Personnummer personnummer = createPersonnummer(errors, personId).orElse(null); if (errors.hasErrors()) { return errors; } validatePUServiceResponse(errors, personnummer); if (errors.hasErrors()) { return errors; } validateSekretessmarkeringOchIntygsTyp(errors, personnummer, intyg.getTypAvIntyg(), user); validateCreateForAvlidenPatientAllowed(errors, personnummer, intyg.getTypAvIntyg().getCode()); return errors; }
CreateDraftCertificateValidatorImpl extends BaseCreateDraftCertificateValidator implements CreateDraftCertificateValidator { @Override public ResultValidator validateApplicationErrors(Intyg intyg, IntygUser user) { ResultValidator errors = ResultValidator.newInstance(); String personId = intyg.getPatient().getPersonId().getExtension(); Personnummer personnummer = createPersonnummer(errors, personId).orElse(null); if (errors.hasErrors()) { return errors; } validatePUServiceResponse(errors, personnummer); if (errors.hasErrors()) { return errors; } validateSekretessmarkeringOchIntygsTyp(errors, personnummer, intyg.getTypAvIntyg(), user); validateCreateForAvlidenPatientAllowed(errors, personnummer, intyg.getTypAvIntyg().getCode()); return errors; } }
CreateDraftCertificateValidatorImpl extends BaseCreateDraftCertificateValidator implements CreateDraftCertificateValidator { @Override public ResultValidator validateApplicationErrors(Intyg intyg, IntygUser user) { ResultValidator errors = ResultValidator.newInstance(); String personId = intyg.getPatient().getPersonId().getExtension(); Personnummer personnummer = createPersonnummer(errors, personId).orElse(null); if (errors.hasErrors()) { return errors; } validatePUServiceResponse(errors, personnummer); if (errors.hasErrors()) { return errors; } validateSekretessmarkeringOchIntygsTyp(errors, personnummer, intyg.getTypAvIntyg(), user); validateCreateForAvlidenPatientAllowed(errors, personnummer, intyg.getTypAvIntyg().getCode()); return errors; }  }
CreateDraftCertificateValidatorImpl extends BaseCreateDraftCertificateValidator implements CreateDraftCertificateValidator { @Override public ResultValidator validateApplicationErrors(Intyg intyg, IntygUser user) { ResultValidator errors = ResultValidator.newInstance(); String personId = intyg.getPatient().getPersonId().getExtension(); Personnummer personnummer = createPersonnummer(errors, personId).orElse(null); if (errors.hasErrors()) { return errors; } validatePUServiceResponse(errors, personnummer); if (errors.hasErrors()) { return errors; } validateSekretessmarkeringOchIntygsTyp(errors, personnummer, intyg.getTypAvIntyg(), user); validateCreateForAvlidenPatientAllowed(errors, personnummer, intyg.getTypAvIntyg().getCode()); return errors; }  @Override ResultValidator validate(Intyg intyg); @Override ResultValidator validateApplicationErrors(Intyg intyg, IntygUser user); }
CreateDraftCertificateValidatorImpl extends BaseCreateDraftCertificateValidator implements CreateDraftCertificateValidator { @Override public ResultValidator validateApplicationErrors(Intyg intyg, IntygUser user) { ResultValidator errors = ResultValidator.newInstance(); String personId = intyg.getPatient().getPersonId().getExtension(); Personnummer personnummer = createPersonnummer(errors, personId).orElse(null); if (errors.hasErrors()) { return errors; } validatePUServiceResponse(errors, personnummer); if (errors.hasErrors()) { return errors; } validateSekretessmarkeringOchIntygsTyp(errors, personnummer, intyg.getTypAvIntyg(), user); validateCreateForAvlidenPatientAllowed(errors, personnummer, intyg.getTypAvIntyg().getCode()); return errors; }  @Override ResultValidator validate(Intyg intyg); @Override ResultValidator validateApplicationErrors(Intyg intyg, IntygUser user);  }