use of se.inera.intyg.webcert.persistence.utkast.model.Utkast in project webcert by sklintyg.
the class NotificationServiceImplTest method createUtkast.
private Utkast createUtkast() {
Utkast utkast = new Utkast();
utkast.setIntygsId(INTYG_ID);
utkast.setIntygsTyp(INTYG_TYP_FK);
utkast.setEnhetsId(ENHET_ID);
utkast.setStatus(UtkastStatus.DRAFT_INCOMPLETE);
utkast.setModel(INTYG_JSON);
utkast.setPatientPersonnummer(PATIENT_ID);
return utkast;
}
use of se.inera.intyg.webcert.persistence.utkast.model.Utkast in project webcert by sklintyg.
the class UtkastApiControllerTest method testCreateUtkast.
@Test
public void testCreateUtkast() {
String intygsTyp = "luse";
setupUser(AuthoritiesConstants.PRIVILEGE_SKRIVA_INTYG, intygsTyp, AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST);
when(utkastService.createNewDraft(any(CreateNewDraftRequest.class))).thenReturn(new Utkast());
Response response = utkastController.createUtkast(intygsTyp, buildRequest("luse"));
assertEquals(OK.getStatusCode(), response.getStatus());
}
use of se.inera.intyg.webcert.persistence.utkast.model.Utkast in project webcert by sklintyg.
the class UtkastApiControllerTest method buildUtkast.
private Utkast buildUtkast(Personnummer personnr) {
Utkast utkast = new Utkast();
utkast.setIntygsTyp("luse");
utkast.setVardgivarId("456");
utkast.setStatus(UtkastStatus.DRAFT_COMPLETE);
utkast.setSenastSparadAv(new VardpersonReferens());
utkast.setSenastSparadDatum(LocalDateTime.now());
utkast.setPatientPersonnummer(personnr);
return utkast;
}
use of se.inera.intyg.webcert.persistence.utkast.model.Utkast in project webcert by sklintyg.
the class UtkastApiControllerTest method testCreateUtkastSetsPatientFullNameWithoutMiddlename.
@Test
public void testCreateUtkastSetsPatientFullNameWithoutMiddlename() {
String intygsTyp = "luse";
setupUser(AuthoritiesConstants.PRIVILEGE_SKRIVA_INTYG, intygsTyp, AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST);
when(utkastService.createNewDraft(any(CreateNewDraftRequest.class))).thenReturn(new Utkast());
// Fake PU service being down
when(patientDetailsResolver.resolvePatient(PATIENT_PERSONNUMMER, intygsTyp)).thenReturn(null);
CreateUtkastRequest utkastRequest = buildRequest("luse");
// no middlename
utkastRequest.setPatientMellannamn(null);
Response response = utkastController.createUtkast(intygsTyp, utkastRequest);
assertEquals(OK.getStatusCode(), response.getStatus());
ArgumentCaptor<CreateNewDraftRequest> requestCaptor = ArgumentCaptor.forClass(CreateNewDraftRequest.class);
verify(utkastService).createNewDraft(requestCaptor.capture());
assertNotNull(requestCaptor.getValue().getPatient().getFullstandigtNamn());
assertEquals(PATIENT_FORNAMN + " " + PATIENT_EFTERNAMN, requestCaptor.getValue().getPatient().getFullstandigtNamn());
}
use of se.inera.intyg.webcert.persistence.utkast.model.Utkast in project webcert by sklintyg.
the class UtkastApiControllerTest method testCreateUtkastFornamnOk.
@Test
public void testCreateUtkastFornamnOk() {
String intygsTyp = "luse";
setupUser(AuthoritiesConstants.PRIVILEGE_SKRIVA_INTYG, intygsTyp, AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST);
when(utkastService.createNewDraft(any(CreateNewDraftRequest.class))).thenReturn(new Utkast());
CreateUtkastRequest utkastRequest = buildRequest(intygsTyp);
utkastRequest.setPatientFornamn(Strings.repeat("a", 255));
Response response = utkastController.createUtkast(intygsTyp, utkastRequest);
assertEquals(OK.getStatusCode(), response.getStatus());
}
Aggregations