### Question:
CollectionUtils { public static Map<String, String> toStringMap(String... pairs) { Map<String, String> parameters = new HashMap<>(); if (pairs.length > 0) { if (pairs.length % 2 != 0) { throw new IllegalArgumentException("pairs must be even."); } for (int i = 0; i < pairs.length; i = i + 2) { parameters.put(pairs[i], pairs[i + 1]); } } return parameters; } private  CollectionUtils(); @SuppressWarnings({"unchecked", "rawtypes"}) static List<T> sort(List<T> list); static List<String> sortSimpleName(List<String> list); static Map<String, Map<String, String>> splitAll(Map<String, List<String>> list, String separator); static Map<String, List<String>> joinAll(Map<String, Map<String, String>> map, String separator); static Map<String, String> split(List<String> list, String separator); static List<String> join(Map<String, String> map, String separator); static String join(List<String> list, String separator); static boolean mapEquals(Map<?, ?> map1, Map<?, ?> map2); static Map<String, String> toStringMap(String... pairs); @SuppressWarnings("unchecked") static Map<K, V> toMap(Object... pairs); static boolean isEmpty(Collection<?> collection); static boolean isNotEmpty(Collection<?> collection); static boolean isEmptyMap(Map map); static boolean isNotEmptyMap(Map map);  }### Answer:
@Test public void testStringMap1() throws Exception { assertThat(toStringMap("key", "value"), equalTo(Collections.singletonMap("key", "value"))); }
@Test public void testStringMap2() throws Exception { Assertions.assertThrows(IllegalArgumentException.class, () -> toStringMap("key", "value", "odd")); }