Search in sources :

Example 36 with TestClass

use of org.junit.runners.model.TestClass in project junit4 by junit-team.

the class RuleMemberValidatorTest method rejectMethodStaticMethodRule.

@Test
public void rejectMethodStaticMethodRule() {
    TestClass target = new TestClass(TestMethodWithStaticMethodRule.class);
    RULE_METHOD_VALIDATOR.validate(target, errors);
    assertOneErrorWithMessage("The @Rule 'getSomeMethodRule' must not be static.");
}
Also used : TestClass(org.junit.runners.model.TestClass) Test(org.junit.Test)

Example 37 with TestClass

use of org.junit.runners.model.TestClass in project junit4 by junit-team.

the class RuleMemberValidatorTest method acceptMethodRule.

@Test
public void acceptMethodRule() throws Exception {
    TestClass target = new TestClass(TestWithMethodRule.class);
    RULE_VALIDATOR.validate(target, errors);
    assertNumberOfErrors(0);
}
Also used : TestClass(org.junit.runners.model.TestClass) Test(org.junit.Test)

Example 38 with TestClass

use of org.junit.runners.model.TestClass in project junit4 by junit-team.

the class RuleMemberValidatorTest method acceptStaticTestRuleThatIsAlsoClassRule.

@Test
public void acceptStaticTestRuleThatIsAlsoClassRule() {
    TestClass target = new TestClass(TestWithStaticClassAndTestRule.class);
    CLASS_RULE_VALIDATOR.validate(target, errors);
    assertNumberOfErrors(0);
}
Also used : TestClass(org.junit.runners.model.TestClass) Test(org.junit.Test)

Example 39 with TestClass

use of org.junit.runners.model.TestClass in project junit4 by junit-team.

the class RuleMemberValidatorTest method acceptNonStaticTestRule.

@Test
public void acceptNonStaticTestRule() {
    TestClass target = new TestClass(TestWithNonStaticTestRule.class);
    RULE_VALIDATOR.validate(target, errors);
    assertNumberOfErrors(0);
}
Also used : TestClass(org.junit.runners.model.TestClass) Test(org.junit.Test)

Example 40 with TestClass

use of org.junit.runners.model.TestClass in project junit4 by junit-team.

the class CategoryValidatorTest method errorIsAddedWhenCategoryIsUsedWithBeforeClass.

@Test
public void errorIsAddedWhenCategoryIsUsedWithBeforeClass() {
    FrameworkMethod method = new TestClass(CategoryTest.class).getAnnotatedMethods(BeforeClass.class).get(0);
    testAndAssertErrorMessage(method, "@BeforeClass can not be combined with @Category");
}
Also used : BeforeClass(org.junit.BeforeClass) TestClass(org.junit.runners.model.TestClass) FrameworkMethod(org.junit.runners.model.FrameworkMethod) 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