예제 #1
0
 @Test
 public void methodRejectArbitraryObjectWithRuleAnnotation() throws Exception {
   TestClass target = new TestClass(MethodTestWithArbitraryObjectWithRuleAnnotation.class);
   RULE_METHOD_VALIDATOR.validate(target, errors);
   assertOneErrorWithMessage(
       "The @Rule 'getArbitraryObject' must return an implementation of MethodRule or TestRule.");
 }
예제 #2
0
 @Test
 public void rejectMethodStaticTestRule() {
   TestClass target = new TestClass(TestMethodWithStaticTestRule.class);
   RULE_METHOD_VALIDATOR.validate(target, errors);
   assertOneErrorWithMessage(
       "The @Rule 'getTemporaryFolder' must not be static or it has to be annotated with @ClassRule.");
 }
예제 #3
0
 @Test
 public void methodAcceptMethodRuleMethod() throws Exception {
   TestClass target = new TestClass(MethodTestWithMethodRule.class);
   RULE_METHOD_VALIDATOR.validate(target, errors);
   assertNumberOfErrors(0);
 }
예제 #4
0
 @Test
 public void acceptMethodNonStaticTestRule() {
   TestClass target = new TestClass(TestMethodWithNonStaticTestRule.class);
   RULE_METHOD_VALIDATOR.validate(target, errors);
   assertNumberOfErrors(0);
 }