@Test public void defaultConstructor() { boolean constructor = ReflectionUtils.hasNoArgsConstructor(TestClass.class); assertThat(constructor, is(true)); }
@Test public void privateConstructor() { boolean constructor = ReflectionUtils.hasNoArgsConstructor(PrivateConstructorClass.class); assertThat(constructor, is(false)); } }
@Test public void noDefaultConstructor() { boolean constructor = ReflectionUtils.hasNoArgsConstructor(NoDefaultConstructorClass.class); assertThat(constructor, is(false)); }
throw new RuleDefinitionException(clazz.getName() + " must be annotated with @Rule annotation."); if (!ReflectionUtils.hasNoArgsConstructor(clazz)) { throw new RuleDefinitionException(clazz.getName() + " must define an empty default constructor.");