use of se.inera.intyg.webcert.persistence.utkast.model.Utkast 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.persistence.utkast.model.Utkast 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.persistence.utkast.model.Utkast 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.persistence.utkast.model.Utkast in project webcert by sklintyg.
the class IntygDraftsConverterTest method testConvertIntygToListEntries.
@Test
public void testConvertIntygToListEntries() {
LocalDateTime modfied = LocalDateTime.parse("2014-01-01T10:00:00");
String id = "123";
String type = "type";
String updatedSignedBy = "Dr Dengroth";
String updatedSignedByHsaId = "HSA1234";
Personnummer patientId = Personnummer.createPersonnummer("19121212-1212").get();
List<Utkast> utkastList = Collections.singletonList(TestIntygFactory.createUtkast(id, modfied, type, updatedSignedBy, updatedSignedByHsaId, UtkastStatus.DRAFT_COMPLETE, patientId));
List<ListIntygEntry> res = IntygDraftsConverter.convertUtkastsToListIntygEntries(utkastList);
assertNotNull(res);
assertEquals(1, res.size());
ListIntygEntry ref = res.get(0);
assertEquals(id, ref.getIntygId());
assertEquals(type, ref.getIntygType());
assertEquals("DRAFT_COMPLETE", ref.getStatus());
assertEquals(updatedSignedBy, ref.getUpdatedSignedBy());
assertEquals(modfied, ref.getLastUpdatedSigned());
}
use of se.inera.intyg.webcert.persistence.utkast.model.Utkast in project webcert by sklintyg.
the class IntygDraftsConverterTest method testConvertUtkastToListIntygEntryResolvesSignedByNameReturnsSignaturHsaId.
@Test
public void testConvertUtkastToListIntygEntryResolvesSignedByNameReturnsSignaturHsaId() {
Signatur signatur = mock(Signatur.class);
Utkast utkast = createUtkast();
utkast.setStatus(UtkastStatus.SIGNED);
utkast.setSignatur(signatur);
when(signatur.getSigneradAv()).thenReturn(utkast.getSenastSparadAv().getNamn());
ListIntygEntry res = IntygDraftsConverter.convertUtkastToListIntygEntry(utkast);
assertNotNull(res);
assertEquals(utkast.getSenastSparadAv().getNamn(), res.getUpdatedSignedBy());
}
Aggregations