### Question:
CollectionUtils { public static <T> T singleValue(Collection<T> values) { if (values.size() != 1) { throw new IllegalArgumentException("Expected single element, actual: " + values.size()); } return values.iterator().next(); }  static T singleValue(Collection<T> values); static List<T> join(Collection<T> first, Collection<T> second); static List<T> minus(Collection<T> first, Collection<T> second); static Set<T> joinToSet(Collection<T> first, Collection<T> second); @SafeVarargs static Set<T> setOf(T... t);  }### Answer:
@Test void testSingleValue() { assertEquals("1", singleValue(singletonList("1"))); assertThrows(IllegalArgumentException.class, () -> singleValue(asList("1", "2"))); assertThrows(IllegalArgumentException.class, () -> singleValue(emptyList())); }