SplitCommaReverseService implements SplitGeocoderStringService { public String combine(List<String> matchedStrings) { StringBuilder sb = new StringBuilder(); for (int i = matchedStrings.size() - 1; i >= 0; i--) { sb.append(matchedStrings.get(i)); sb.append(", "); } if (sb.length() == 0) { return ""; } else { return sb.substring(0, sb.length() - 2); } }  List<String> split(String location); String combine(List<String> matchedStrings);  }
@Test public void testCombine() throws Exception { SplitCommaReverseService service = new SplitCommaReverseService(); List<String> list = new ArrayList<String>(); list.add(PART0); list.add(PART1); list.add(PART2); Assert.assertEquals(FULL, service.combine(list)); }
@Test public void testCombine2() throws Exception { SplitCommaReverseService service = new SplitCommaReverseService(); List<String> list = new ArrayList<String>(); Assert.assertEquals("", service.combine(list)); }