@Test public void testMergeWithBothListsFilled() { List<ListIntygEntry> intygList = TestIntygFactory.createListWithIntygItems(); List<Utkast> utkastList = TestIntygFactory.createListWithUtkast(); List<ListIntygEntry> res = IntygDraftsConverter.merge(intygList, utkastList); assertNotNull(res); assertFalse(res.isEmpty()); assertEquals(4, res.size()); assertOrder(res, "4321"); }
public static List<ListIntygEntry> merge(List<ListIntygEntry> intygList, List<Utkast> utkastList) { LOG.debug("Merging intyg, signed {}, drafts {}", intygList.size(), utkastList.size()); return Stream.concat( intygList.stream(), utkastList.stream() .map(IntygDraftsConverter::convertUtkastToListIntygEntry)) .sorted(INTYG_ENTRY_DATE_COMPARATOR_DESC) .collect(Collectors.toList()); }
IntygDraftsConverter { public static List<ListIntygEntry> merge(List<ListIntygEntry> intygList, List<Utkast> utkastList) { LOG.debug("Merging intyg, signed {}, drafts {}", intygList.size(), utkastList.size()); return Stream.concat( intygList.stream(), utkastList.stream() .map(IntygDraftsConverter::convertUtkastToListIntygEntry)) .sorted(INTYG_ENTRY_DATE_COMPARATOR_DESC) .collect(Collectors.toList()); } }
IntygDraftsConverter { public static List<ListIntygEntry> merge(List<ListIntygEntry> intygList, List<Utkast> utkastList) { LOG.debug("Merging intyg, signed {}, drafts {}", intygList.size(), utkastList.size()); return Stream.concat( intygList.stream(), utkastList.stream() .map(IntygDraftsConverter::convertUtkastToListIntygEntry)) .sorted(INTYG_ENTRY_DATE_COMPARATOR_DESC) .collect(Collectors.toList()); }  }
IntygDraftsConverter { public static List<ListIntygEntry> merge(List<ListIntygEntry> intygList, List<Utkast> utkastList) { LOG.debug("Merging intyg, signed {}, drafts {}", intygList.size(), utkastList.size()); return Stream.concat( intygList.stream(), 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> merge(List<ListIntygEntry> intygList, List<Utkast> utkastList) { LOG.debug("Merging intyg, signed {}, drafts {}", intygList.size(), utkastList.size()); return Stream.concat( intygList.stream(), 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);  }