### Question:
ClassUtils { public static int getSize(Object object) { if (object == null) { return 0; } if (object instanceof Collection<?>) { return ((Collection<?>) object).size(); } else if (object instanceof Map<?, ?>) { return ((Map<?, ?>) object).size(); } else if (object.getClass().isArray()) { return Array.getLength(object); } else { return -1; } } private  ClassUtils(); static Object newInstance(String name); static Class<?> forName(String[] packages, String className); static Class<?> forName(String className); static Class<?> classForName(String className); static Class<?> getBoxedClass(Class<?> type); static Boolean boxed(boolean v); static Character boxed(char v); static Byte boxed(byte v); static Short boxed(short v); static Integer boxed(int v); static Long boxed(long v); static Float boxed(float v); static Double boxed(double v); static Object boxed(Object v); static boolean unboxed(Boolean v); static char unboxed(Character v); static byte unboxed(Byte v); static short unboxed(Short v); static int unboxed(Integer v); static long unboxed(Long v); static float unboxed(Float v); static double unboxed(Double v); static Object unboxed(Object v); static boolean isNotEmpty(Object object); static int getSize(Object object); static URI toURI(String name); static Class<?> getGenericClass(Class<?> cls); static Class<?> getGenericClass(Class<?> cls, int i); static boolean isBeforeJava5(String javaVersion); static boolean isBeforeJava6(String javaVersion); static String toString(Throwable e); static void checkBytecode(String name, byte[] bytecode); static String getSizeMethod(Class<?> cls); static String getMethodName(Method method, Class<?>[] parameterClasses, String rightCode); static Method searchMethod(Class<?> currentClass, String name, Class<?>[] parameterTypes); static String getInitCode(Class<?> type); static Map<K, V> toMap(Map.Entry<K, V>[] entries); static final String CLASS_EXTENSION; static final String JAVA_EXTENSION; }### Answer:
@Test public void testGetSize() { Assertions.assertEquals(0, ClassUtils.getSize(null)); List<Integer> list = new ArrayList<>(); list.add(1); Assertions.assertEquals(1, ClassUtils.getSize(list)); Map map = new HashMap(); map.put(1, 1); Assertions.assertEquals(1, ClassUtils.getSize(map)); int[] array = new int[1]; Assertions.assertEquals(1, ClassUtils.getSize(array)); Assertions.assertEquals(-1, ClassUtils.getSize(new Object())); }