### Question:
CachingInvocationHandler implements InvocationHandler { protected static Class[] toParameterTypes(Object[] args) { if (args == null || args.length == 0) return new Class<?>[]{ }; Class<?>[] types = new Class<?>[args.length]; for (int i = 0; i < args.length; i++) types[i] = args[i] != null ? args[i].getClass() : null; return types; } CachingInvocationHandler(Object interfaceClass, Object delegate); @Override Object invoke(Object proxy, Method method, Object[] args);  }### Answer:
@Test public void toParameterTypes_returns_empty() { assertEquals(0, CachingInvocationHandler.toParameterTypes(null).length); assertEquals(0, CachingInvocationHandler.toParameterTypes(new Object[]{ }).length); }
@Test public void toParameterTypes_returns_expected_classes() { assertArrayEquals(new Class<?>[]{ Integer.class, String.class }, CachingInvocationHandler.toParameterTypes(new Object[]{ 1, "hello" })); }