### Question:
CachingInvocationHandler implements InvocationHandler { protected static boolean matchParameterTypes(Class<?>[] parameterTypes1, Class<?>[] parameterTypes2) { if (parameterTypes1 == null || parameterTypes1.length == 0) return parameterTypes2 == null || parameterTypes2.length == 0; if (parameterTypes1.length != parameterTypes2.length) return false; boolean equals = true; for (int i = 0; i < parameterTypes1.length; i++) { Class<?> class1 = ClassUtils.primitiveToWrapper(parameterTypes1[i]); Class<?> class2 = ClassUtils.primitiveToWrapper(parameterTypes2[i]); if (class2 == null) continue; if (! class1.equals(class2)) { equals = false; break; } } return equals; } CachingInvocationHandler(Object interfaceClass, Object delegate); @Override Object invoke(Object proxy, Method method, Object[] args);  }### Answer:
@Test public void matchParameterTypes_returns_true_when_null_or_empty() { assertTrue(CachingInvocationHandler.matchParameterTypes(null, null)); assertTrue(CachingInvocationHandler.matchParameterTypes(new Class<?>[]{}, new Class<?>[]{})); assertTrue(CachingInvocationHandler.matchParameterTypes(null, new Class<?>[]{ })); assertTrue(CachingInvocationHandler.matchParameterTypes(new Class<?>[]{ }, null)); }
@Test public void matchParameterTypes_returns_false_when_length_is_different() { assertFalse(CachingInvocationHandler.matchParameterTypes(new Class<?>[]{ int.class }, new Class<?>[]{ })); }
@Test public void matchParameterTypes_returns_true_when_parameters_are_the_same() { assertTrue(CachingInvocationHandler.matchParameterTypes(new Class<?>[]{ int.class }, new Class<?>[]{ int.class })); }
@Test public void matchParameterTypes_returns_true_also_when_parameters_use_primitive_and_classes() { assertTrue(CachingInvocationHandler.matchParameterTypes(new Class<?>[]{ int.class }, new Class<?>[]{ Integer.class })); }
@Test public void matchParameterTypes_returns_true_also_when_one_of_parameters_2_is_null() { assertTrue(CachingInvocationHandler.matchParameterTypes(new Class<?>[]{ int.class }, new Class<?>[]{ null })); }