class AbstractObjectConverter {

    protected void checkIfArgumentsMatchParameterTypes(Object[] arguments, Class<?>[] parameterTypes) {
        checkNotNull(arguments, "'arguments' must not be null");
        checkNotNull(parameterTypes, "'testMethod' must not be null");
        checkArgument(parameterTypes.length >= arguments.length,
                "Expected at most %d arguments for test method but got %d.", parameterTypes.length, arguments.length);

        for (int idx = 0; idx < arguments.length; idx++) {
            Object object = arguments[idx];
            if (object != null) {
                Class<?> paramType = parameterTypes[idx];
                if (!paramType.isInstance(object) && !isWrappedInstance(paramType, object)
                        && !isWideningConversion(paramType, object)) {
                    throw new IllegalArgumentException(
                            String.format("Parameter number %d is of type '%s' but argument given is '%s' of type '%s'",
                                    idx, paramType.getSimpleName(), object, object.getClass().getSimpleName()));
                }
            }
        }
    }

}