### Question:
GenericTypeUtil { static Class<?> rawClass(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) type; if (parameterizedType.getRawType() instanceof Class) { return (Class<?>) parameterizedType.getRawType(); } } else if (type instanceof GenericArrayType) { GenericArrayType array = (GenericArrayType) type; final Class<?> componentRawType = rawClass(array.getGenericComponentType()); return getArrayClass(componentRawType); } throw new IllegalArgumentException("Type parameter " + type + " is not a class or parameterized type whose raw type is a class"); } private  GenericTypeUtil();   }### Answer:
@Test public void testRawClass() { Class<?> claszResult = GenericTypeUtil.rawClass(Object.class); assertFalse(claszResult.isInterface()); assertFalse(claszResult.isArray()); assertEquals("class java.lang.Object", claszResult.toString()); assertEquals(1, claszResult.getModifiers()); assertFalse(claszResult.isEnum()); assertFalse(claszResult.isSynthetic()); assertFalse(claszResult.isAnnotation()); assertFalse(claszResult.isPrimitive()); }
@Test public void testRawClassThrowsIllegalArgumentException() { assertThrows(IllegalArgumentException.class, () -> GenericTypeUtil.rawClass(null)); }