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);
}
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);
}
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());
}
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);
}
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);
}
Aggregations