@Test public void testWriteWithFrequency() { ModsDefinition mods = new ModsDefinition(); mods.getOriginInfo().add(originInfo(Role.PRINTER, "printer[0]", "date0", "place0")); mods.getOriginInfo().add(originInfo(Role.PRINTER, "printer[1]", "date1", "place1")); mods.getOriginInfo().add(originInfo(Role.OTHER, "unknown[2]", "date2", "place2")); mods.getOriginInfo().add(originInfo(Role.PUBLISHER, "publisher[3]", "date3", "place3")); mods.getOriginInfo().add(originInfo(Role.OTHER, "unknown[4]", null, null)); mods.getOriginInfo().add(originInfo(Role.PUBLISHER, "publisher[5]", "date5", "place5")); mods.getOriginInfo().add(frequency("weekly")); List<PublisherItem> publishers = Arrays.asList( new PublisherItem(3, null, "publisher[3]-updated", "date3-updated", "place3-updated"), new PublisherItem(null, null, "publisher[insert][3-5]", "date-inserted", "place5-inserted"), new PublisherItem(5, null, "publisher[5]", "date5", "place5") ); List<PublisherItem> printers = Arrays.asList( new PublisherItem(1, null, "printer[1]", "date1", "place1"), new PublisherItem(null, null, "printer[add][1]", "date1", "place1") ); List<OriginInfoItem> expected = Arrays.asList( new PeriodicityItem(0, Arrays.asList("weekly", "daily"), OriginInfoMapper.ISSUANCE_CONTINUING), new PublisherItem(1, Role.PUBLISHER, "publisher[3]-updated", "date3-updated", "place3-updated"), new PublisherItem(2, Role.PUBLISHER, "publisher[insert][3-5]", "date-inserted", "place5-inserted"), new PublisherItem(3, Role.PUBLISHER, "publisher[5]", "date5", "place5"), new PublisherItem(4, Role.PRINTER, "printer[1]", "date1", "place1"), new PublisherItem(5, Role.PRINTER, "printer[add][1]", "date1", "place1"), new PublisherItem(6, Role.OTHER, null, null, null), new PublisherItem(7, Role.OTHER, null, null, null) ); OriginInfoMapper instance = new OriginInfoMapper(); instance.map(mods, publishers, printers, Arrays.asList("weekly", "daily"), OriginInfoMapper.ISSUANCE_CONTINUING); List<OriginInfoItem> result = instance.map(mods); assertThat(result, Is.is(expected)); }
public List<OriginInfoItem> map(ModsDefinition mods) { List<OriginInfoDefinition> origins = mods.getOriginInfo(); return originsMap.map(origins); }
OriginInfoMapper { public List<OriginInfoItem> map(ModsDefinition mods) { List<OriginInfoDefinition> origins = mods.getOriginInfo(); return originsMap.map(origins); } }
OriginInfoMapper { public List<OriginInfoItem> map(ModsDefinition mods) { List<OriginInfoDefinition> origins = mods.getOriginInfo(); return originsMap.map(origins); }  }
OriginInfoMapper { public List<OriginInfoItem> map(ModsDefinition mods) { List<OriginInfoDefinition> origins = mods.getOriginInfo(); return originsMap.map(origins); }  List<OriginInfoItem> map(ModsDefinition mods); ModsDefinition map(ModsDefinition mods, List<PublisherItem> publishers, List<PublisherItem> printers, String issuance); ModsDefinition map(ModsDefinition mods, List<PublisherItem> publishers, List<PublisherItem> printers, List<String> frequencies, String issuance); ModsDefinition map(ModsDefinition mods, List<OriginInfoItem> origins); static List<PublisherItem> filter(List<? extends OriginInfoItem> origins, boolean include, Role first, Role... rest); static List<PublisherItem> filter(List<? extends OriginInfoItem> origins, Set<Role> filter, boolean include); static List<String> getFreqencies(List<? extends OriginInfoItem> origins); static String getIssuance(List<? extends OriginInfoItem> origins); }
OriginInfoMapper { public List<OriginInfoItem> map(ModsDefinition mods) { List<OriginInfoDefinition> origins = mods.getOriginInfo(); return originsMap.map(origins); }  List<OriginInfoItem> map(ModsDefinition mods); ModsDefinition map(ModsDefinition mods, List<PublisherItem> publishers, List<PublisherItem> printers, String issuance); ModsDefinition map(ModsDefinition mods, List<PublisherItem> publishers, List<PublisherItem> printers, List<String> frequencies, String issuance); ModsDefinition map(ModsDefinition mods, List<OriginInfoItem> origins); static List<PublisherItem> filter(List<? extends OriginInfoItem> origins, boolean include, Role first, Role... rest); static List<PublisherItem> filter(List<? extends OriginInfoItem> origins, Set<Role> filter, boolean include); static List<String> getFreqencies(List<? extends OriginInfoItem> origins); static String getIssuance(List<? extends OriginInfoItem> origins); static final String ISSUANCE_CONTINUING; static final String ISSUANCE_MONOGRAPHIC; }