use of org.junit.runners.model.TestClass in project buck by facebook.
the class DelegateRunNotifier method hasJunitTimeout.
boolean hasJunitTimeout(Description description) {
// Do not do apply the default timeout if the test has its own @Test(timeout).
Test testAnnotation = description.getAnnotation(Test.class);
if (testAnnotation != null && testAnnotation.timeout() > 0) {
return true;
}
// Do not do apply the default timeout if the test has its own @Rule Timeout.
TestClass testClass = getTestClass(description);
if (BuckBlockJUnit4ClassRunner.hasTimeoutRule(testClass)) {
return true;
}
return false;
}
use of org.junit.runners.model.TestClass in project materialistic by hidroh.
the class ParameterizedTestRunner method getParametersMethod.
private FrameworkMethod getParametersMethod() throws Exception {
TestClass testClass = getTestClass();
List<FrameworkMethod> methods = testClass.getAnnotatedMethods(Parameters.class);
for (FrameworkMethod each : methods) {
int modifiers = each.getMethod().getModifiers();
if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers)) {
return each;
}
}
throw new Exception("No public static parameters method on class " + testClass.getName());
}
use of org.junit.runners.model.TestClass in project junit4 by junit-team.
the class AnnotationsValidatorTest method assertClassHasFailureMessage.
private void assertClassHasFailureMessage(Class<?> klass, String expectedFailure) {
AnnotationsValidator validator = new AnnotationsValidator();
Collection<Exception> errors = validator.validateTestClass(new TestClass(klass));
assertThat(errors.size(), is(1));
assertThat(errors.iterator().next().getMessage(), is(expectedFailure));
}
use of org.junit.runners.model.TestClass in project junit4 by junit-team.
the class PublicClassValidatorTest method rejectsNonPublicClass.
@Test
public void rejectsNonPublicClass() {
TestClass testClass = new TestClass(NonPublicClass.class);
List<Exception> validationErrors = validator.validateTestClass(testClass);
assertThat("Wrong number of errors.", validationErrors.size(), is(equalTo(1)));
}
use of org.junit.runners.model.TestClass in project junit4 by junit-team.
the class PublicClassValidatorTest method acceptsPublicClass.
@Test
public void acceptsPublicClass() {
TestClass testClass = new TestClass(PublicClass.class);
List<Exception> validationErrors = validator.validateTestClass(testClass);
assertThat(validationErrors, is(equalTo(Collections.<Exception>emptyList())));
}
Aggregations