StringLibrary { public static <K, V> Map<String, String> asStringMap(Map<K, V> sourceMap) { return mapWithStringValues(mapWithStringKeys(sourceMap)); }  static String unique(String string); static String quoted(String string); static List<String> split(String chainedStrings, Character character); static List<String> split(String chainedStrings, String splittingRegex); static String join(Collection<String> subStrings, Character connector); static String join(Collection<String> subStrings, String connector); static String stripEnd(String string, String suffix); static String firstAfterSplit(String string, Character character); static String firstAfterSplit(String string, String splittingRegex); static String lastAfterSplit(String string, Character character); static String lastAfterSplit(String string, String splittingRegex); static String reversed(String string); static List<String> toStringList(Collection<? extends Object> objects); static List<String> toStringList(Collection<? extends Object> objects, String nullString); static Map<String, String> asStringMap(Map<K, V> sourceMap); static Map<String, V> mapWithStringKeys(Map<K, V> sourceMap); static Map<K, String> mapWithStringValues(Map<K, V> sourceMap); static int maximumToStringLength(Collection<? extends Object> objects, int lengthOfNullToString); static String rightFilled(String string, int targetLength, Character filler); static Collection<String> rightFilled(Collection<String> strings, int targetLength, Character filler); static String leftFilled(String string, int targetLength, Character filler); static Collection<String> leftFilled(Collection<String> strings, int targetLength, Character filler); static String repeated(Character character, int times); static String repeated(String text, int times); static String plainDecimalRepresentation(Number number);  }
@Test public void convertMapToStringMap() { Map<Integer, Boolean> map = new HashMap<Integer, Boolean>(); map.put(0, false); map.put(1, true); Map<String, String> stringMap = asStringMap(map); assertEquals(2, stringMap.size()); assertTrue(stringMap.containsKey("0")); assertEquals("false", stringMap.get("0")); assertTrue(stringMap.containsKey("1")); assertEquals("true", stringMap.get("1")); }