Search in sources :

Example 1 with ListCertificatesForCareWithQAType

use of se.riv.clinicalprocess.healthcond.certificate.listCertificatesForCareWithQA.v3.ListCertificatesForCareWithQAType in project webcert by sklintyg.

the class ListCertificatesForCareWithQAResponderImplTest method missingPersonnummerShouldThrow.

@Test(expected = IllegalArgumentException.class)
public void missingPersonnummerShouldThrow() {
    ListCertificatesForCareWithQAType request = new ListCertificatesForCareWithQAType();
    HsaId hsaId = new HsaId();
    hsaId.setExtension("enhetId");
    request.getEnhetsId().add(hsaId);
    HsaId vardgivarId = new HsaId();
    hsaId.setExtension("vardgivarId");
    request.setVardgivarId(vardgivarId);
    responder.listCertificatesForCareWithQA("logicalAdress", request);
}
Also used : ListCertificatesForCareWithQAType(se.riv.clinicalprocess.healthcond.certificate.listCertificatesForCareWithQA.v3.ListCertificatesForCareWithQAType) HsaId(se.riv.clinicalprocess.healthcond.certificate.types.v3.HsaId) Test(org.junit.Test)

Example 2 with ListCertificatesForCareWithQAType

use of se.riv.clinicalprocess.healthcond.certificate.listCertificatesForCareWithQA.v3.ListCertificatesForCareWithQAType in project webcert by sklintyg.

the class ListCertificatesForCareWithQAResponderImplTest method testListCertificatesForCareWithQA.

@Test
public void testListCertificatesForCareWithQA() {
    final Personnummer personnummer = Personnummer.createPersonnummer("191212121212").get();
    final String enhet = "enhetHsaId";
    final LocalDate deadline = LocalDate.of(2017, 1, 1);
    final String reference = "ref";
    Handelse handelse = new Handelse();
    handelse.setCode(HandelsekodEnum.SKAPAT);
    handelse.setTimestamp(LocalDateTime.now());
    handelse.setAmne(ArendeAmne.AVSTMN);
    handelse.setSistaDatumForSvar(deadline);
    when(intygService.listCertificatesForCareWithQA(any(IntygWithNotificationsRequest.class))).thenReturn(Arrays.asList(new IntygWithNotificationsResponse(null, Arrays.asList(handelse), new ArendeCount(1, 1, 1, 1), new ArendeCount(2, 2, 2, 2), reference)));
    ListCertificatesForCareWithQAType request = new ListCertificatesForCareWithQAType();
    PersonId personId = new PersonId();
    personId.setExtension(personnummer.getPersonnummer());
    request.setPersonId(personId);
    HsaId hsaId = new HsaId();
    hsaId.setExtension(enhet);
    request.getEnhetsId().add(hsaId);
    ListCertificatesForCareWithQAResponseType response = responder.listCertificatesForCareWithQA("logicalAdress", request);
    assertNotNull(response);
    assertNotNull(response.getList());
    assertNotNull(response.getList().getItem());
    assertEquals(1, response.getList().getItem().size());
    assertEquals(1, response.getList().getItem().get(0).getHandelser().getHandelse().size());
    assertEquals(reference, response.getList().getItem().get(0).getRef());
    assertEquals(deadline, response.getList().getItem().get(0).getHandelser().getHandelse().get(0).getSistaDatumForSvar());
    assertEquals(HandelsekodEnum.SKAPAT.name(), response.getList().getItem().get(0).getHandelser().getHandelse().get(0).getHandelsekod().getCode());
    assertEquals(ArendeAmne.AVSTMN.name(), response.getList().getItem().get(0).getHandelser().getHandelse().get(0).getAmne().getCode());
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) ListCertificatesForCareWithQAResponseType(se.riv.clinicalprocess.healthcond.certificate.listCertificatesForCareWithQA.v3.ListCertificatesForCareWithQAResponseType) PersonId(se.riv.clinicalprocess.healthcond.certificate.types.v3.PersonId) ArendeCount(se.inera.intyg.common.support.modules.support.api.notification.ArendeCount) IntygWithNotificationsResponse(se.inera.intyg.webcert.web.service.intyg.dto.IntygWithNotificationsResponse) IntygWithNotificationsRequest(se.inera.intyg.webcert.web.service.intyg.dto.IntygWithNotificationsRequest) ListCertificatesForCareWithQAType(se.riv.clinicalprocess.healthcond.certificate.listCertificatesForCareWithQA.v3.ListCertificatesForCareWithQAType) LocalDate(java.time.LocalDate) HsaId(se.riv.clinicalprocess.healthcond.certificate.types.v3.HsaId) Handelse(se.inera.intyg.webcert.persistence.handelse.model.Handelse) Test(org.junit.Test)

Example 3 with ListCertificatesForCareWithQAType

use of se.riv.clinicalprocess.healthcond.certificate.listCertificatesForCareWithQA.v3.ListCertificatesForCareWithQAType in project webcert by sklintyg.

the class ListCertificatesForCareWithQAResponderImplTest method missingBothEnhetAndVardgivareShouldNotThrow.

@Test
public void missingBothEnhetAndVardgivareShouldNotThrow() {
    ListCertificatesForCareWithQAType request = new ListCertificatesForCareWithQAType();
    PersonId personId = new PersonId();
    personId.setExtension("191212121212");
    request.setPersonId(personId);
    responder.listCertificatesForCareWithQA("logicalAdress", request);
}
Also used : PersonId(se.riv.clinicalprocess.healthcond.certificate.types.v3.PersonId) ListCertificatesForCareWithQAType(se.riv.clinicalprocess.healthcond.certificate.listCertificatesForCareWithQA.v3.ListCertificatesForCareWithQAType) Test(org.junit.Test)

Example 4 with ListCertificatesForCareWithQAType

use of se.riv.clinicalprocess.healthcond.certificate.listCertificatesForCareWithQA.v3.ListCertificatesForCareWithQAType in project webcert by sklintyg.

the class ListCertificatesForCareWithQAResponderImplTest method bothEnhetAndVardgivareExistingShouldThrow.

@Test(expected = IllegalArgumentException.class)
public void bothEnhetAndVardgivareExistingShouldThrow() {
    ListCertificatesForCareWithQAType request = new ListCertificatesForCareWithQAType();
    PersonId personId = new PersonId();
    personId.setExtension("191212121212");
    request.setPersonId(personId);
    HsaId hsaId = new HsaId();
    hsaId.setExtension("enhetId");
    request.getEnhetsId().add(hsaId);
    HsaId vardgivarId = new HsaId();
    hsaId.setExtension("vardgivarId");
    request.setVardgivarId(vardgivarId);
    responder.listCertificatesForCareWithQA("logicalAdress", request);
}
Also used : PersonId(se.riv.clinicalprocess.healthcond.certificate.types.v3.PersonId) ListCertificatesForCareWithQAType(se.riv.clinicalprocess.healthcond.certificate.listCertificatesForCareWithQA.v3.ListCertificatesForCareWithQAType) HsaId(se.riv.clinicalprocess.healthcond.certificate.types.v3.HsaId) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 ListCertificatesForCareWithQAType (se.riv.clinicalprocess.healthcond.certificate.listCertificatesForCareWithQA.v3.ListCertificatesForCareWithQAType)4 HsaId (se.riv.clinicalprocess.healthcond.certificate.types.v3.HsaId)3 PersonId (se.riv.clinicalprocess.healthcond.certificate.types.v3.PersonId)3 LocalDate (java.time.LocalDate)1 ArendeCount (se.inera.intyg.common.support.modules.support.api.notification.ArendeCount)1 Personnummer (se.inera.intyg.schemas.contract.Personnummer)1 Handelse (se.inera.intyg.webcert.persistence.handelse.model.Handelse)1 IntygWithNotificationsRequest (se.inera.intyg.webcert.web.service.intyg.dto.IntygWithNotificationsRequest)1 IntygWithNotificationsResponse (se.inera.intyg.webcert.web.service.intyg.dto.IntygWithNotificationsResponse)1 ListCertificatesForCareWithQAResponseType (se.riv.clinicalprocess.healthcond.certificate.listCertificatesForCareWithQA.v3.ListCertificatesForCareWithQAResponseType)1