### Question:
TypeUtil { @SuppressWarnings({ "unchecked", "PMD.CollapsibleIfStatements" }) public static <T> Class<T> getType(final Object object) { if (object instanceof Double || object instanceof Float) { return (Class<T>) Double.class; } else if (object instanceof Number) { return (Class<T>) Long.class; } else if (object instanceof Boolean) { return (Class<T>) Boolean.class; } else if (object instanceof String) { if (JSON_DATE.matcher((String) object).matches()) { return (Class<T>) Date.class; } } else if(object instanceof Calendar) { return (Class<T>) Calendar.class; } else if(object instanceof Date) { return (Class<T>) Date.class; } return (Class<T>) String.class; } private  TypeUtil(); static Map<T, T> arrayToMap(T[] list); static Map<String, Object> toMap(JsonObject json); @SuppressWarnings({ "unchecked", "PMD.CollapsibleIfStatements" }) static Class<T> getType(final Object object); static T toObjectType(String data, Class<T> klass); static String toString(final Object obj, final Class<?> klass); static String toString(final Object obj, final Class<?> klass, String methodName); static String toString(final Object obj); static ValueMap toValueMap(final Map<String, ?> map);  }### Answer:
@Test public void testGetType_Double() { assertEquals(TypeUtil.getType(Double.valueOf(10000.00001)), Double.class); }
@Test public void testGetType_Float() { assertEquals(Double.class, TypeUtil.getType(Float.valueOf((float) 100.001))); }
@Test public void testGetType_Long() { assertEquals(Long.class, TypeUtil.getType(Long.valueOf(100000000))); }
@Test public void testGetType_Boolean() { assertEquals(Boolean.class, TypeUtil.getType(Boolean.TRUE)); }
@Test public void testGetType_Date() { assertEquals(Date.class, TypeUtil.getType("1997-07-16T19:20:30.450+01:00")); }
@Test public void testGetType_String() { assertEquals(String.class, TypeUtil.getType("Hello World!")); }