BeanClassUtils { public static boolean hasDefaultConstructor(Class cls) { Constructor[] constructors = cls.getConstructors(); for (Constructor constructor : constructors) { if (constructor.getParameterTypes().length == 0) { return true; } } return false; }  static T createInstance(Class<T> cls); static T createInstance(Class<T> cls, Constructor constructor, List argValues); static T createInstance(Class<T> cls, Constructor constructor, Object... args); static T createCollectionInstance(Class<?> collectionClass); static boolean hasDefaultConstructor(Class cls); static Class safeGetClass(String type); static Constructor safeGetConstructor(Class cls, Class[] types); static Method safeGetMethod(Class cls, String methodName, Class[] argumentTypes); static Object invokeStaticMethod(Class cls, String methodName, Object[] args);  }
@Test public void testHasDefaultConstructor() { boolean shouldBeTrue = BeanClassUtils.hasDefaultConstructor(SimpleAssociationDTO.class); assertTrue("The class SimpleAssociationDTO has a default constructor", shouldBeTrue); boolean shouldBeFalse = BeanClassUtils.hasDefaultConstructor(SimpleImmutableDTO.class); assertFalse("The class SimpleImmutableDTO does not have a default constructor", shouldBeFalse); }