Search in sources :

Example 41 with TestClass

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;
}
Also used : Test(org.junit.Test) TestClass(org.junit.runners.model.TestClass)

Example 42 with TestClass

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());
}
Also used : TestClass(org.junit.runners.model.TestClass) FrameworkMethod(org.junit.runners.model.FrameworkMethod)

Example 43 with TestClass

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));
}
Also used : TestClass(org.junit.runners.model.TestClass)

Example 44 with TestClass

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)));
}
Also used : TestClass(org.junit.runners.model.TestClass) Test(org.junit.Test)

Example 45 with TestClass

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())));
}
Also used : TestClass(org.junit.runners.model.TestClass) Test(org.junit.Test)

Aggregations

TestClass (org.junit.runners.model.TestClass)60 Test (org.junit.Test)41 FrameworkMethod (org.junit.runners.model.FrameworkMethod)12 PotentialAssignment (org.junit.experimental.theories.PotentialAssignment)6 SpecificDataPointsSupplier (org.junit.experimental.theories.internal.SpecificDataPointsSupplier)6 Annotation (java.lang.annotation.Annotation)3 URL (java.net.URL)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 PluginClassLoader (com.intellij.ide.plugins.cl.PluginClassLoader)2 HashMap (java.util.HashMap)2 AfterClass (org.junit.AfterClass)2 BeforeClass (org.junit.BeforeClass)2 IntegrationTest (tech.sirwellington.alchemy.annotations.testing.IntegrationTest)2 Interaction (au.com.dius.pact.model.Interaction)1 Pact (au.com.dius.pact.model.Pact)1 ConsumerInfo (au.com.dius.pact.provider.ConsumerInfo)1 ProviderInfo (au.com.dius.pact.provider.ProviderInfo)1 ProviderVerifier (au.com.dius.pact.provider.ProviderVerifier)1 Provider (au.com.dius.pact.provider.junit.Provider)1