### Question:
ClassUtils { public static Class<?> getElementsClassOf(Class<?> clazz) { if (clazz.isArray()) { return clazz.getComponentType(); } if (Collection.class.isAssignableFrom(clazz)) { logger.warn("In Java its not possible to discover de Generic type of a collection like: {}", clazz); return Object.class; } return clazz; } private  ClassUtils(); static boolean isArrayOrCollection(Class<?> clazz); static Class<?> getElementsClassOf(Class<?> clazz); static boolean isVoid(Class<?> clazz);  }### Answer:
@Test public void givenArray_whenGetElementsClassOf_thenReturnTheClassOfElements() { assertThat(getElementsClassOf(String[].class), is(typeCompatibleWith(String.class))); assertThat(getElementsClassOf(Integer[].class), is(typeCompatibleWith(Integer.class))); assertThat(getElementsClassOf(Contact[].class), is(typeCompatibleWith(Contact.class))); }