KitUtils { public static String join(List<String> list) { return join(list, ","); }  static String sanitizeAttributeKey(String key); static BigInteger hashFnv1a(byte[] bytes); static int hashForFiltering(String input); static boolean isEmpty(CharSequence str); static String join(List<String> list); static String join(List<String> list, String delimiter); static boolean isServiceAvailable(Context context, Class<?> service); static boolean parseBooleanSetting(Map<String, String> settings, String key, boolean defaultValue); static boolean parseBooleanSetting(Map<String, String> settings, String key);  }
@Test public void testJoin() throws Exception { List<String> testList = new LinkedList<>(); testList.add("1"); testList.add("test"); testList.add("test 2"); assertEquals("1,test,test 2", KitUtils.join(testList)); assertEquals("", KitUtils.join(new LinkedList<String>())); List<String> singleElementList = new LinkedList<>(); singleElementList.add("tester"); assertEquals("tester", KitUtils.join(singleElementList)); }
@Test public void testJoinWithDelimiter() throws Exception { List<String> testList = new LinkedList<>(); testList.add("1"); testList.add("test"); testList.add("test 2"); assertEquals("", KitUtils.join(new LinkedList<String>(), "whatever")); List<String> singleElementList = new LinkedList<>(); singleElementList.add("tester"); assertEquals("tester", KitUtils.join(singleElementList, "whatever")); assertEquals("1whatevertestwhatevertest 2", KitUtils.join(testList, "whatever")); }