code: public static <T> T invokeConstructor(Class<T> classThatContainsTheConstructorToTest, Object... arguments)
              throws Exception {
  
          if (classThatContainsTheConstructorToTest == null) {
              throw new IllegalArgumentException("The class should contain the constructor cannot be null.");
          }
  
          Class<?>[] argumentTypes = null;
          if (arguments == null) {
              argumentTypes = new Class<?>[0];
          } else {
              argumentTypes = new Class<?>[arguments.length];
              for (int i = 0; i < arguments.length; i++) {
                  argumentTypes[i] = getType(arguments[i]);
              }
          }
  
          Constructor<T> constructor = null;
  
          constructor = getBestCandidateConstructor(classThatContainsTheConstructorToTest, argumentTypes, arguments);
  
          return createInstance(constructor, arguments);
      }
docs: Invoke a constructor. Useful for testing classes with a private
  constructor.
  
  @param <T>                                   the generic type
  @param classThatContainsTheConstructorToTest the class that contains the constructor to test
  @param arguments                             the arguments
  @return The object created after the constructor has been invoked.
  @throws Exception If an exception occur when invoking the constructor.