Search in sources :

Example 1 with Relations

use of se.inera.intyg.webcert.web.web.controller.api.dto.Relations in project webcert by sklintyg.

the class IntygRelationHelperImplTest method testGetRelationsForIntygOneInITAndThreeFromWebcertIncludingParent.

@Test
public void testGetRelationsForIntygOneInITAndThreeFromWebcertIncludingParent() {
    when(listRelationsForCertificateResponderInterface.listRelationsForCertificate(isNull(), any(ListRelationsForCertificateType.class))).thenReturn(buildResponse());
    when(certificateRelationService.getRelations(INTYG_ID)).thenReturn(buildWebcertRelationsWithParent());
    Relations relationsForIntyg = testee.getRelationsForIntyg(INTYG_ID);
    assertNotNull(relationsForIntyg);
    assertFrontendRelationsIntygsIds(relationsForIntyg.getLatestChildRelations(), OTHER_INTYG_ID_3, null, OTHER_INTYG_ID, OTHER_INTYG_ID_2);
}
Also used : ListRelationsForCertificateType(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateType) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations) IntygRelations(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.IntygRelations) Test(org.junit.Test)

Example 2 with Relations

use of se.inera.intyg.webcert.web.web.controller.api.dto.Relations in project webcert by sklintyg.

the class IntygRelationHelperImplTest method testGetRelationsForIntygNothingInIT.

@Test
public void testGetRelationsForIntygNothingInIT() {
    when(listRelationsForCertificateResponderInterface.listRelationsForCertificate(isNull(), any(ListRelationsForCertificateType.class))).thenReturn(new ListRelationsForCertificateResponseType());
    Relations relationsForIntyg = testee.getRelationsForIntyg(INTYG_ID);
    assertNotNull(relationsForIntyg);
}
Also used : ListRelationsForCertificateResponseType(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType) ListRelationsForCertificateType(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateType) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations) IntygRelations(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.IntygRelations) Test(org.junit.Test)

Example 3 with Relations

use of se.inera.intyg.webcert.web.web.controller.api.dto.Relations in project webcert by sklintyg.

the class IntygRelationHelperImplTest method testGetRelationsForIntygNothingInITWithMergeFromWebcert.

@Test
public void testGetRelationsForIntygNothingInITWithMergeFromWebcert() {
    when(listRelationsForCertificateResponderInterface.listRelationsForCertificate(isNull(), any(ListRelationsForCertificateType.class))).thenReturn(new ListRelationsForCertificateResponseType());
    Relations webcertRelations = new Relations();
    Relations.FrontendRelations fr = webcertRelations.getLatestChildRelations();
    fr.setReplacedByIntyg(new WebcertCertificateRelation(OTHER_INTYG_ID_2, RelationKod.ERSATT, LocalDateTime.now().minusDays(1), UtkastStatus.SIGNED));
    fr.setReplacedByUtkast(new WebcertCertificateRelation(OTHER_INTYG_ID_2, RelationKod.ERSATT, LocalDateTime.now().minusDays(1), UtkastStatus.DRAFT_COMPLETE));
    fr.setComplementedByIntyg(new WebcertCertificateRelation(OTHER_INTYG_ID_2, RelationKod.KOMPLT, LocalDateTime.now().minusDays(2), UtkastStatus.SIGNED));
    fr.setComplementedByUtkast(new WebcertCertificateRelation(OTHER_INTYG_ID_2, RelationKod.KOMPLT, LocalDateTime.now().minusDays(2), UtkastStatus.DRAFT_INCOMPLETE));
    webcertRelations.setParent(new WebcertCertificateRelation(PARENT_INTYG_1, RelationKod.KOMPLT, LocalDateTime.now().minusDays(3), UtkastStatus.SIGNED));
    when(certificateRelationService.getRelations(INTYG_ID)).thenReturn(webcertRelations);
    Relations relationsForIntyg = testee.getRelationsForIntyg(INTYG_ID);
    assertNotNull(relationsForIntyg);
    assertFrontendRelations(relationsForIntyg.getLatestChildRelations(), webcertRelations.getLatestChildRelations().getComplementedByIntyg(), webcertRelations.getLatestChildRelations().getComplementedByUtkast(), webcertRelations.getLatestChildRelations().getReplacedByIntyg(), webcertRelations.getLatestChildRelations().getReplacedByUtkast());
}
Also used : ListRelationsForCertificateResponseType(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType) ListRelationsForCertificateType(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateType) WebcertCertificateRelation(se.inera.intyg.webcert.common.model.WebcertCertificateRelation) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations) IntygRelations(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.IntygRelations) Test(org.junit.Test)

Example 4 with Relations

use of se.inera.intyg.webcert.web.web.controller.api.dto.Relations in project webcert by sklintyg.

the class IntygRelationHelperImplTest method testGetRelationsForIntygOneInIT.

@Test
public void testGetRelationsForIntygOneInIT() {
    when(listRelationsForCertificateResponderInterface.listRelationsForCertificate(isNull(), any(ListRelationsForCertificateType.class))).thenReturn(buildResponse());
    Relations relationsForIntyg = testee.getRelationsForIntyg(INTYG_ID);
    assertNotNull(relationsForIntyg);
    assertFrontendRelationsIntygsIds(relationsForIntyg.getLatestChildRelations(), null, null, OTHER_INTYG_ID, null);
}
Also used : ListRelationsForCertificateType(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateType) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations) IntygRelations(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.IntygRelations) Test(org.junit.Test)

Example 5 with Relations

use of se.inera.intyg.webcert.web.web.controller.api.dto.Relations in project webcert by sklintyg.

the class IntygRelationHelperImplTest method testGetRelationsForIntygOneParentInIT.

@Test
public void testGetRelationsForIntygOneParentInIT() {
    when(listRelationsForCertificateResponderInterface.listRelationsForCertificate(isNull(), any(ListRelationsForCertificateType.class))).thenReturn(buildResponseWithParent());
    Relations relationsForIntyg = testee.getRelationsForIntyg(INTYG_ID);
    assertNotNull(relationsForIntyg);
    assertEquals(PARENT_INTYG_1, relationsForIntyg.getParent().getIntygsId());
    assertFrontendRelations(relationsForIntyg.getLatestChildRelations(), null, null, null, null);
}
Also used : ListRelationsForCertificateType(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateType) Relations(se.inera.intyg.webcert.web.web.controller.api.dto.Relations) IntygRelations(se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.IntygRelations) Test(org.junit.Test)

Aggregations

Relations (se.inera.intyg.webcert.web.web.controller.api.dto.Relations)27 Test (org.junit.Test)12 IntygRelations (se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.IntygRelations)11 ListRelationsForCertificateType (se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateType)7 Patient (se.inera.intyg.common.support.model.common.internal.Patient)7 WebcertCertificateRelation (se.inera.intyg.webcert.common.model.WebcertCertificateRelation)7 ClassPathResource (org.springframework.core.io.ClassPathResource)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 Personnummer (se.inera.intyg.schemas.contract.Personnummer)5 ArrayList (java.util.ArrayList)4 ListRelationsForCertificateResponseType (se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.ListRelationsForCertificateResponseType)4 Fk7263Utlatande (se.inera.intyg.common.fk7263.model.internal.Fk7263Utlatande)4 Status (se.inera.intyg.common.support.model.Status)4 Response (javax.ws.rs.core.Response)3 Before (org.junit.Before)3 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)3 ModuleNotFoundException (se.inera.intyg.common.support.modules.registry.ModuleNotFoundException)3 CertificateResponse (se.inera.intyg.common.support.modules.support.api.dto.CertificateResponse)3 ValidationStatus (se.inera.intyg.common.support.modules.support.api.dto.ValidationStatus)3 ModuleException (se.inera.intyg.common.support.modules.support.api.exception.ModuleException)3