@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()); }
public static List<ListIntygEntry> convertUtkastsToListIntygEntries(List<Utkast> utkastList) { return utkastList.stream() .map(IntygDraftsConverter::convertUtkastToListIntygEntry) .sorted(INTYG_ENTRY_DATE_COMPARATOR_DESC) .collect(Collectors.toList()); }
IntygDraftsConverter { public static List<ListIntygEntry> convertUtkastsToListIntygEntries(List<Utkast> utkastList) { return utkastList.stream() .map(IntygDraftsConverter::convertUtkastToListIntygEntry) .sorted(INTYG_ENTRY_DATE_COMPARATOR_DESC) .collect(Collectors.toList()); } }
IntygDraftsConverter { public static List<ListIntygEntry> convertUtkastsToListIntygEntries(List<Utkast> utkastList) { return utkastList.stream() .map(IntygDraftsConverter::convertUtkastToListIntygEntry) .sorted(INTYG_ENTRY_DATE_COMPARATOR_DESC) .collect(Collectors.toList()); }  }
IntygDraftsConverter { public static List<ListIntygEntry> convertUtkastsToListIntygEntries(List<Utkast> utkastList) { return utkastList.stream() .map(IntygDraftsConverter::convertUtkastToListIntygEntry) .sorted(INTYG_ENTRY_DATE_COMPARATOR_DESC) .collect(Collectors.toList()); }  static List<ListIntygEntry> merge(List<ListIntygEntry> intygList, List<Utkast> utkastList); static List<ListIntygEntry> convertUtkastsToListIntygEntries(List<Utkast> utkastList); static ListIntygEntry convertUtkastToListIntygEntry(Utkast utkast); static CertificateState findLatestStatus(List<IntygsStatus> intygStatuses); static String resolveStatus(Utkast draft); List<ListIntygEntry> convertIntygToListIntygEntries(List<Intyg> intygList, List<ListIntygEntry> webcertIntyg); }
IntygDraftsConverter { public static List<ListIntygEntry> convertUtkastsToListIntygEntries(List<Utkast> utkastList) { return utkastList.stream() .map(IntygDraftsConverter::convertUtkastToListIntygEntry) .sorted(INTYG_ENTRY_DATE_COMPARATOR_DESC) .collect(Collectors.toList()); }  static List<ListIntygEntry> merge(List<ListIntygEntry> intygList, List<Utkast> utkastList); static List<ListIntygEntry> convertUtkastsToListIntygEntries(List<Utkast> utkastList); static ListIntygEntry convertUtkastToListIntygEntry(Utkast utkast); static CertificateState findLatestStatus(List<IntygsStatus> intygStatuses); static String resolveStatus(Utkast draft); List<ListIntygEntry> convertIntygToListIntygEntries(List<Intyg> intygList, List<ListIntygEntry> webcertIntyg);  }