### Question:
CollectionUtils { public static <T> Collection<T> asCollection(Collection<T> c) { if (c == null) { return new HashSet<>(); } return c; } private  CollectionUtils(); @SafeVarargs static Set<T> asSet(T... items); @SuppressWarnings({ "rawtypes", "unchecked" }) static Set<T> asSet(Collection<T> c); static Set<T> asSet(Iterator<T> it); static Set<T> asSet(Iterable<T> iterable); @SafeVarargs static List<T> asList(T... items); static List<T> asList(List<T> list); static List<T> asList(Collection<T> c); static Collection<T> nonNull(Collection<T> c); static Collection<T> asCollection(Collection<T> c); static List<T> asList(Enumeration<T> enumeration); static List<T> asList(Iterable<T> it); static List<T> asList(Iterator<T> it); @SuppressWarnings("unchecked") // we checked the elements of the list static List<T> asList(List<?> list, Class<T> clazz); @SuppressWarnings("unchecked") // we checked the elements of the collection static Collection<T> asCollection(Collection<?> collection, Class<T> clazz); static boolean isAllSameType(Collection<?> list, Class<T> clazz); @SafeVarargs // this is safe, as we are only using Object methods static boolean isOneOf(T t, T... possibles); static boolean isAllNull(Object... objects); static boolean isAllNull(Collection<T> c); static boolean isBlank(Collection<T> c); @SuppressWarnings("unchecked") static boolean isBlank(T... t); static Iterable<T> asIterable(T t); static Iterable<T> asIterable(Iterator<T> iterator); @SafeVarargs static Iterable<T> asIterable(Iterable<T>... iterables); static Stream<T> asStream(Iterator<T> iterator); @SafeVarargs static Stream<T> asStream(Iterable<T>... iterables); static T any(Collection<T> c); static T any(Iterable<T> iterable);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testAsCollection_UnknownToType_MixedTypes() { List<Object> list = new ArrayList<>(); list.add("A"); list.add(Integer.valueOf(1)); list.add("C"); CollectionUtils.asCollection(list, String.class); }