### Question:
PropertyUtil { public static boolean isCollectionProperty(Type type, boolean includeMaps) { if (type instanceof Class) { return isCollectionProperty((Class<?>)type, includeMaps); } if (type instanceof ParameterizedType) { return isCollectionProperty((Class<?>)((ParameterizedType) type).getRawType(), includeMaps); } return false; } private  PropertyUtil(); static boolean isSimpleProperty(Class<?> clazz); static boolean isSimpleValueType(Class<?> clazz); static boolean isCollectionProperty(Type type, boolean includeMaps); static boolean isCollectionProperty(Class<?> clazz, boolean includeMaps); static boolean isMapProperty(Type type); static boolean isMapProperty(Class<?> clazz); static Class<?> getCollectionElementType(Type type); static Object getProperty(Object bean, String name); static void setProperty(Object bean, String name, Object value); static Method getReadMethod(Object bean, String name); static Boolean isPrimitiveOrWrapper(Class<?> clazz);  }### Answer:
@Test public void shouldCheckIfCollectionPropertyForMap() { assertTrue(PropertyUtil.isCollectionProperty(HashMap.class, true)); assertFalse(PropertyUtil.isCollectionProperty(String.class, true)); }
@Test public void shouldCheckCollectionPropertyWithType() throws Exception { assertTrue(PropertyUtil.isCollectionProperty(DummyClass.class.getField("stringList").getGenericType(), false)); assertTrue(PropertyUtil.isCollectionProperty(DummyClass.class.getField("objectList").getGenericType(), false)); assertTrue(PropertyUtil.isCollectionProperty(new HashSet<String>().getClass(), false)); assertTrue(PropertyUtil.isCollectionProperty(new HashSet<DummyClass>().getClass(), false)); assertFalse(PropertyUtil.isCollectionProperty(DummyClass.class.getField("boxed").getGenericType(), false)); assertFalse(PropertyUtil.isCollectionProperty(String.class, false)); assertFalse(PropertyUtil.isCollectionProperty(HashMap.class, false)); assertFalse(PropertyUtil.isCollectionProperty(DummyClass.class.getField("genericObjectArray").getGenericType(), false)); }
@Test public void shouldCheckIfCollectionPropertyWithClass() { assertTrue(PropertyUtil.isCollectionProperty(ArrayList.class, false)); assertTrue(PropertyUtil.isCollectionProperty(HashSet.class, false)); assertFalse(PropertyUtil.isCollectionProperty(String.class, false)); assertFalse(PropertyUtil.isCollectionProperty(HashMap.class, false)); }