use of org.junit.runners.model.TestClass in project junit4 by junit-team.
the class RuleMemberValidatorTest method rejectArbitraryObjectWithRuleAnnotation.
@Test
public void rejectArbitraryObjectWithRuleAnnotation() throws Exception {
TestClass target = new TestClass(TestWithArbitraryObjectWithRuleAnnotation.class);
RULE_VALIDATOR.validate(target, errors);
assertOneErrorWithMessage("The @Rule 'arbitraryObject' must implement MethodRule or TestRule.");
}
use of org.junit.runners.model.TestClass in project junit4 by junit-team.
the class RuleMemberValidatorTest method methodRejectProtectedClassRule.
@Test
public void methodRejectProtectedClassRule() {
TestClass target = new TestClass(MethodTestWithProtectedClassRule.class);
CLASS_RULE_METHOD_VALIDATOR.validate(target, errors);
assertOneErrorWithMessage("The @ClassRule 'getTemporaryFolder' must be public.");
}
use of org.junit.runners.model.TestClass in project junit4 by junit-team.
the class RuleMemberValidatorTest method rejectProtectedClassRule.
@Test
public void rejectProtectedClassRule() {
TestClass target = new TestClass(TestWithProtectedClassRule.class);
CLASS_RULE_VALIDATOR.validate(target, errors);
assertOneErrorWithMessage("The @ClassRule 'temporaryFolder' must be public.");
}
use of org.junit.runners.model.TestClass in project junit4 by junit-team.
the class RuleMemberValidatorTest method rejectClassRuleThatReturnsImplementationOfMethodRule.
/**
* If there is any method annotated with @ClassRule then it must return an
* implementation of {@link TestRule}
*
* <p>This case has been added with
* <a href="https://github.com/junit-team/junit4/issues/1019">Issue #1019</a>
*/
@Test
public void rejectClassRuleThatReturnsImplementationOfMethodRule() {
TestClass target = new TestClass(TestWithClassRuleMethodThatReturnsMethodRule.class);
CLASS_RULE_METHOD_VALIDATOR.validate(target, errors);
assertOneErrorWithMessage("The @ClassRule 'methodRule' must return an implementation of TestRule.");
}
use of org.junit.runners.model.TestClass in project junit4 by junit-team.
the class RuleMemberValidatorTest method methodAcceptMethodRuleMethod.
@Test
public void methodAcceptMethodRuleMethod() throws Exception {
TestClass target = new TestClass(MethodTestWithMethodRule.class);
RULE_METHOD_VALIDATOR.validate(target, errors);
assertNumberOfErrors(0);
}
Aggregations