use of se.inera.intyg.webcert.web.web.controller.api.dto.ListIntygEntry in project webcert by sklintyg.
the class IntygDraftsConverterTest method testConvertUtkastToListIntygEntrySetsStatusSentIfApplicable.
@Test
public void testConvertUtkastToListIntygEntrySetsStatusSentIfApplicable() {
Utkast utkast = createUtkast();
utkast.setStatus(UtkastStatus.SIGNED);
utkast.setSkickadTillMottagareDatum(LocalDateTime.now());
ListIntygEntry res = IntygDraftsConverter.convertUtkastToListIntygEntry(utkast);
assertNotNull(res);
assertEquals(CertificateState.SENT.name(), res.getStatus());
}
use of se.inera.intyg.webcert.web.web.controller.api.dto.ListIntygEntry in project webcert by sklintyg.
the class IntygDraftsConverterTest method testConvertUtkastToListIntygEntrySetsCancelledFirst.
@Test
public void testConvertUtkastToListIntygEntrySetsCancelledFirst() {
Signatur signatur = mock(Signatur.class);
Utkast utkast = createUtkast();
utkast.setStatus(UtkastStatus.SIGNED);
utkast.setSignatur(signatur);
utkast.setAterkalladDatum(LocalDateTime.now());
utkast.setSkickadTillMottagareDatum(LocalDateTime.now());
when(signatur.getSigneringsDatum()).thenReturn(LocalDateTime.now());
ListIntygEntry res = IntygDraftsConverter.convertUtkastToListIntygEntry(utkast);
assertNotNull(res);
assertEquals(CertificateState.CANCELLED.name(), res.getStatus());
}
use of se.inera.intyg.webcert.web.web.controller.api.dto.ListIntygEntry in project webcert by sklintyg.
the class IntygDraftsConverterTest method testConvertUtkastToListIntygEntrySetsUtkastStatusIfNoOtherAvailable.
@Test
public void testConvertUtkastToListIntygEntrySetsUtkastStatusIfNoOtherAvailable() {
ListIntygEntry res = IntygDraftsConverter.convertUtkastToListIntygEntry(createUtkast());
assertNotNull(res);
assertEquals(UtkastStatus.DRAFT_INCOMPLETE.name(), res.getStatus());
}
use of se.inera.intyg.webcert.web.web.controller.api.dto.ListIntygEntry in project webcert by sklintyg.
the class IntygDraftsConverterTest method testConvertUtkastToListIntygEntryResolvesSignedByNameNoSignatur.
@Test
public void testConvertUtkastToListIntygEntryResolvesSignedByNameNoSignatur() {
final String senastSparadAvName = "Anders Andersson";
Utkast utkast = createUtkast();
utkast.getSenastSparadAv().setNamn(senastSparadAvName);
ListIntygEntry res = IntygDraftsConverter.convertUtkastToListIntygEntry(utkast);
assertNotNull(res);
assertEquals(senastSparadAvName, res.getUpdatedSignedBy());
}
use of se.inera.intyg.webcert.web.web.controller.api.dto.ListIntygEntry in project webcert by sklintyg.
the class IntygDraftsConverterTest method assertOrder.
private void assertOrder(List<ListIntygEntry> res, String expectedOrder) {
StringBuilder sb = new StringBuilder();
for (ListIntygEntry entry : res) {
sb.append(entry.getIntygId());
}
assertEquals(expectedOrder, sb.toString());
}
Aggregations