PtlBlockJUnit4ClassRunnerWithParameters extends BlockJUnit4ClassRunnerWithParameters { protected void validateParameterizedBeforeClass(List<Throwable> errors) { for (FrameworkMethod method : getTestClass().getAnnotatedMethods(ParameterizedBeforeClass.class)) { if (!method.isStatic()) { errors.add(new Exception("Method " + method.getName() + "() should be static")); } if (!method.isPublic()) { errors.add(new Exception("Method " + method.getName() + "() should be public")); } if (method.getType() != Void.TYPE) { errors.add(new Exception("Method " + method.getName() + "() should be void")); } } } PtlBlockJUnit4ClassRunnerWithParameters(TestWithParameters test); Description getTestDescription();  }
@Test public void testValidateParameterizedBeforeClass() throws Exception { Result result = JUnitCore.runClasses(ValidateParameterizedBeforeClass.class); assertThat(result.getFailureCount(), is(3)); for (Failure failure : result.getFailures()) { assertThat( failure.getMessage(), is(anyOf(equalTo("Method beforeClass() should be static"), equalTo("Method beforeClass() should be public"), equalTo("Method beforeClass() should be void")))); } }