DialogOptionMapper { public Iterable<? extends DialogOption> mapToVillageFilterOptions(Iterable<Village> villages) { return Iterables.transform(villages, new Function<Village, DialogOption>() { @Override public DialogOption apply(Village village) { return new VillageFilter(StringUtil.humanize(village.name())); } }); }  Iterable<? extends DialogOption> mapToVillageFilterOptions(Iterable<Village> villages);  }
@Test public void shouldMapVillagesToVillageFilterOptions() throws Exception { List<Village> villages = asList(new Village("village1"), new Village("village2")); Iterable<? extends DialogOption> villageFilterOptions = mapper.mapToVillageFilterOptions(villages); VillageFilter[] expectedVillageFilters = ArrayUtils.toArray(new VillageFilter("Village1"), new VillageFilter("Village2")); assertArrayEquals( expectedVillageFilters, toArray(villageFilterOptions, DialogOption.class)); }