Ticket #18408: 18408.1.patch
| File 18408.1.patch, 1.9 KB (added by , 6 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/mappaint/mapcss/Functions.java
982 982 } 983 983 984 984 /** 985 * Trim whitespaces from the strings {@code strings}. 986 * 987 * @param strings The list of strings to strip 988 * @return The resulting string 989 * @see Utils#strip 990 * @since xxx 991 */ 992 public static List<String> trim_list(List<String> strings) { 993 return strings.stream().map(Utils::strip).filter(str -> !str.isEmpty()).collect(Collectors.toList()); 994 } 995 996 /** 985 997 * Check if two strings are similar, but not identical, i.e., have a Levenshtein distance of 1 or 2. 986 998 * @param string1 first string to compare 987 999 * @param string2 second string to compare -
test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java
324 324 assertTrue(c1.matches(new Environment(n1))); 325 325 } 326 326 327 /** 328 * Test case for {@link Functions#trim_list} 329 */ 327 330 @Test 331 public void testTrimList() { 332 List<String> trimmed = Functions.trim_list(Arrays.asList(" A1 ", "A2", " A3", "A4 ", "")); 333 assertEquals(4, trimmed.size()); 334 assertEquals("A1", trimmed.get(0)); 335 assertEquals("A2", trimmed.get(1)); 336 assertEquals("A3", trimmed.get(2)); 337 assertEquals("A4", trimmed.get(3)); 338 } 339 340 @Test 328 341 public void testTicket8568() throws Exception { 329 342 MapCSSStyleSource sheet = new MapCSSStyleSource( 330 343 "way { width: 5; }\n" +
