### Question:
JerseyUtils { public static boolean testType(Class<?> required, Type type) { boolean typeOK = false; if(type instanceof Class<?>){ typeOK = required.isAssignableFrom((Class<?>) type); type = ((Class<?>)type).getGenericSuperclass(); } else if(type instanceof WildcardType){ WildcardType wildcardSetType = (WildcardType) type; if(wildcardSetType.getLowerBounds().length > 0){ Type lowerBound = wildcardSetType.getLowerBounds()[0]; typeOK = lowerBound instanceof Class<?> && required.isAssignableFrom((Class<?>)lowerBound); } else if (wildcardSetType.getUpperBounds().length > 0){ Type upperBound = wildcardSetType.getUpperBounds()[0]; typeOK = upperBound instanceof Class<?> && ((Class<?>)upperBound).isAssignableFrom(required); } else { typeOK = true; } } else if(required.isArray() && type instanceof GenericArrayType){ GenericArrayType arrayType = (GenericArrayType)type; typeOK = testType(required.getComponentType(), arrayType.getGenericComponentType()); } else if(type instanceof ParameterizedType){ ParameterizedType pType = ((ParameterizedType)type); typeOK = pType.getRawType() instanceof Class<?> && required.isAssignableFrom((Class<?>)pType.getRawType()); type = null; } else { typeOK = false; } return typeOK; } private  JerseyUtils(); static FieldQuery createFieldQueryForFindRequest(String name, String field, 
                                                            String language, Integer limit, 
                                                            Integer offset, String ldpath); static boolean testType(Class<?> required, Type type); static boolean testParameterizedType(Class<?> rawType, Class<?>[] parameterTypes, Type type); static Map<String,String> parseForm(InputStream entityStream,String charset); static final Set<String> REPRESENTATION_SUPPORTED_MEDIA_TYPES; static final Set<String> ENTITY_SUPPORTED_MEDIA_TYPES; static final Set<String> QUERY_RESULT_SUPPORTED_MEDIA_TYPES; }### Answer:
@Test public void testType(){ Assert.assertTrue(JerseyUtils.testType(Map.class, HashMap.class)); Assert.assertFalse(JerseyUtils.testType(Map.class, HashSet.class)); Assert.assertTrue(JerseyUtils.testType(Map.class, HashMap.class)); Map<String,Collection<? extends Number>> genericMapTest = new TestMap(); Assert.assertTrue(JerseyUtils.testType(Map.class, genericMapTest.getClass())); Assert.assertFalse(JerseyUtils.testType(Set.class, genericMapTest.getClass())); Assert.assertTrue(JerseyUtils.testType(Map.class, TestMap.class.getGenericSuperclass())); }