@SuppressWarnings("unchecked")
  public static <T> T newInstance(Class<T> theClass, Configuration conf) {
    return newInstance(theClass, conf, EMPTY_ARRAY);
  }
@Test
  public void testNewInstanceForNonDefaultConstructorWithException() {
    try {
      ReflectionUtils.newInstance(
          NoDefaultCtor.class, null, new Class[]{int.class}, 1, 2);
      fail("Should have failed before this point");
    } catch (IllegalArgumentException e) {
      GenericTestUtils.assertExceptionContains(
          "1 parameters are required but 2 arguments are provided", e);
    }

    try {
      ReflectionUtils.newInstance(
          NoDefaultCtor.class, null, new Class[]{int.class});
      fail("Should have failed before this point");
    } catch (IllegalArgumentException e) {
      GenericTestUtils.assertExceptionContains(
          "1 parameters are required but 0 arguments are provided", e);
    }
  }