Skip to content

Commit

Permalink
Merge pull request #902 from ancosen/master
Browse files Browse the repository at this point in the history
#880 Allow static @rule declarations
  • Loading branch information
stefanbirkner committed May 3, 2014
2 parents f8b3669 + 56a0346 commit 5784c8a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -88,7 +88,7 @@ private void validateStatic(FrameworkMember<?> member, List<Throwable> errors) {
addError(errors, member, "must be static.");
}
if (!fStaticMembers && member.isStatic()) {
addError(errors, member, "must not be static.");
addError(errors, member, "must not be static or it has to be annotated with @ClassRule.");
}
}

Expand Down
Expand Up @@ -74,7 +74,7 @@ public static class TestWithNonStaticTestRule {
public void rejectStaticTestRule() {
TestClass target = new TestClass(TestWithStaticTestRule.class);
RULE_VALIDATOR.validate(target, errors);
assertOneErrorWithMessage("The @Rule 'temporaryFolder' must not be static.");
assertOneErrorWithMessage("The @Rule 'temporaryFolder' must not be static or it has to be annotated with @ClassRule.");
}

public static class TestWithStaticTestRule {
Expand Down Expand Up @@ -157,7 +157,7 @@ public TestRule getTemporaryFolder() {
public void rejectMethodStaticTestRule() {
TestClass target = new TestClass(TestMethodWithStaticTestRule.class);
RULE_METHOD_VALIDATOR.validate(target, errors);
assertOneErrorWithMessage("The @Rule 'getTemporaryFolder' must not be static.");
assertOneErrorWithMessage("The @Rule 'getTemporaryFolder' must not be static or it has to be annotated with @ClassRule.");
}

public static class TestMethodWithStaticTestRule {
Expand Down

0 comments on commit 5784c8a

Please sign in to comment.