@Test public void ensureDraftPatientInfoUpdated() { IntegrationParameters parameters = new IntegrationParameters(null, null, ALTERNATE_SSN, null, null, null, null, null, null, false, false, false, false); WebCertUser user = createDefaultUser(); user.setParameters(parameters); testee.ensureDraftPatientInfoUpdated("lisjp", null, 0L, user, null); verify(utkastService, times(1)).updatePatientOnDraft(any(UpdatePatientOnDraftRequest.class)); }
void ensureDraftPatientInfoUpdated(String intygsType, String draftId, long draftVersion, WebCertUser user, Personnummer prepareBeforeAlternateSsn) { authoritiesValidator.given(user, intygsType) .features(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST) .privilege(AuthoritiesConstants.PRIVILEGE_SKRIVA_INTYG) .orThrow(); String alternatePatientSsn = user.getParameters().getAlternateSsn(); if (!Strings.isNullOrEmpty(alternatePatientSsn)) { Personnummer pnr = Personnummer.createPersonnummer(alternatePatientSsn).orElse(null); UpdatePatientOnDraftRequest request; if (prepareBeforeAlternateSsn != null) { request = new UpdatePatientOnDraftRequest(pnr, prepareBeforeAlternateSsn, draftId, draftVersion); } else { request = new UpdatePatientOnDraftRequest(pnr, draftId, draftVersion); } utkastService.updatePatientOnDraft(request); } }
IntygIntegrationServiceImpl extends IntegrationServiceImpl { void ensureDraftPatientInfoUpdated(String intygsType, String draftId, long draftVersion, WebCertUser user, Personnummer prepareBeforeAlternateSsn) { authoritiesValidator.given(user, intygsType) .features(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST) .privilege(AuthoritiesConstants.PRIVILEGE_SKRIVA_INTYG) .orThrow(); String alternatePatientSsn = user.getParameters().getAlternateSsn(); if (!Strings.isNullOrEmpty(alternatePatientSsn)) { Personnummer pnr = Personnummer.createPersonnummer(alternatePatientSsn).orElse(null); UpdatePatientOnDraftRequest request; if (prepareBeforeAlternateSsn != null) { request = new UpdatePatientOnDraftRequest(pnr, prepareBeforeAlternateSsn, draftId, draftVersion); } else { request = new UpdatePatientOnDraftRequest(pnr, draftId, draftVersion); } utkastService.updatePatientOnDraft(request); } } }
IntygIntegrationServiceImpl extends IntegrationServiceImpl { void ensureDraftPatientInfoUpdated(String intygsType, String draftId, long draftVersion, WebCertUser user, Personnummer prepareBeforeAlternateSsn) { authoritiesValidator.given(user, intygsType) .features(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST) .privilege(AuthoritiesConstants.PRIVILEGE_SKRIVA_INTYG) .orThrow(); String alternatePatientSsn = user.getParameters().getAlternateSsn(); if (!Strings.isNullOrEmpty(alternatePatientSsn)) { Personnummer pnr = Personnummer.createPersonnummer(alternatePatientSsn).orElse(null); UpdatePatientOnDraftRequest request; if (prepareBeforeAlternateSsn != null) { request = new UpdatePatientOnDraftRequest(pnr, prepareBeforeAlternateSsn, draftId, draftVersion); } else { request = new UpdatePatientOnDraftRequest(pnr, draftId, draftVersion); } utkastService.updatePatientOnDraft(request); } }  }
IntygIntegrationServiceImpl extends IntegrationServiceImpl { void ensureDraftPatientInfoUpdated(String intygsType, String draftId, long draftVersion, WebCertUser user, Personnummer prepareBeforeAlternateSsn) { authoritiesValidator.given(user, intygsType) .features(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST) .privilege(AuthoritiesConstants.PRIVILEGE_SKRIVA_INTYG) .orThrow(); String alternatePatientSsn = user.getParameters().getAlternateSsn(); if (!Strings.isNullOrEmpty(alternatePatientSsn)) { Personnummer pnr = Personnummer.createPersonnummer(alternatePatientSsn).orElse(null); UpdatePatientOnDraftRequest request; if (prepareBeforeAlternateSsn != null) { request = new UpdatePatientOnDraftRequest(pnr, prepareBeforeAlternateSsn, draftId, draftVersion); } else { request = new UpdatePatientOnDraftRequest(pnr, draftId, draftVersion); } utkastService.updatePatientOnDraft(request); } }   }
IntygIntegrationServiceImpl extends IntegrationServiceImpl { void ensureDraftPatientInfoUpdated(String intygsType, String draftId, long draftVersion, WebCertUser user, Personnummer prepareBeforeAlternateSsn) { authoritiesValidator.given(user, intygsType) .features(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST) .privilege(AuthoritiesConstants.PRIVILEGE_SKRIVA_INTYG) .orThrow(); String alternatePatientSsn = user.getParameters().getAlternateSsn(); if (!Strings.isNullOrEmpty(alternatePatientSsn)) { Personnummer pnr = Personnummer.createPersonnummer(alternatePatientSsn).orElse(null); UpdatePatientOnDraftRequest request; if (prepareBeforeAlternateSsn != null) { request = new UpdatePatientOnDraftRequest(pnr, prepareBeforeAlternateSsn, draftId, draftVersion); } else { request = new UpdatePatientOnDraftRequest(pnr, draftId, draftVersion); } utkastService.updatePatientOnDraft(request); } }    }