### Question:
TypeUtils { public static Type getComponentType(Type type) { Utils.checkNotNull(type, "type"); Type componentType; if (type instanceof Class) { Class<?> klass = (Class<?>) type; if (klass.isArray()) { componentType = klass.getComponentType(); } else { componentType = null; } } else if (type instanceof GenericArrayType) { componentType = ((GenericArrayType) type).getGenericComponentType(); } else { componentType = null; } return componentType; } private  TypeUtils(); static boolean isAssignable(Type supertype, Type type); static boolean isInstance(Type type, Object object); static Type getErasedType(Type type); static Class<?> getRawType(Type type); static boolean isArray(Type type); static Type getComponentType(Type type); static Type getArrayType(Type componentType); static boolean isSimpleParameterizedType(Type type, Class<?> rawType); static Type getActualTypeArgument(Type type); static String toString(Type type); static String toString(Type type, ClassSerializer serializer); static String toUnqualifiedString(Type type);  }### Answer:
@Test(expected = NullPointerException.class) public void getComponentTypeWithNull() { TypeUtils.getComponentType(null); }
@Test public void getComponentTypeWithClass() { assertNull(TypeUtils.getComponentType(Integer.class)); }
@Test public void getComponentTypeWithClassArray() { assertEquals(Integer.class, TypeUtils.getComponentType(Integer[].class)); }
@Test public void getComponentTypeWithTypeVariable() { assertNull(TypeUtils.getComponentType(Types.typeVariable(declaration, "T"))); }
@Test public void getComponentTypeWithGenericArrayType() { assertEquals(Integer.class, TypeUtils.getComponentType(Types.genericArrayType(Integer.class))); }
@Test public void getComponentTypeWithParameterizedType() { assertNull(TypeUtils.getComponentType(Types.parameterizedType(List.class, Integer.class))); }
@Test public void getComponentTypeWithWildcardType() { assertNull(TypeUtils.getComponentType(Types.unboundedWildcardType())); }