Search in sources :

Example 16 with TestClass

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

the class RuleMemberValidatorTest method rejectArbitraryObjectWithRuleAnnotation.

@Test
public void rejectArbitraryObjectWithRuleAnnotation() throws Exception {
    TestClass target = new TestClass(TestWithArbitraryObjectWithRuleAnnotation.class);
    RULE_VALIDATOR.validate(target, errors);
    assertOneErrorWithMessage("The @Rule 'arbitraryObject' must implement MethodRule or TestRule.");
}
Also used : TestClass(org.junit.runners.model.TestClass) Test(org.junit.Test)

Example 17 with TestClass

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

the class RuleMemberValidatorTest method methodRejectProtectedClassRule.

@Test
public void methodRejectProtectedClassRule() {
    TestClass target = new TestClass(MethodTestWithProtectedClassRule.class);
    CLASS_RULE_METHOD_VALIDATOR.validate(target, errors);
    assertOneErrorWithMessage("The @ClassRule 'getTemporaryFolder' must be public.");
}
Also used : TestClass(org.junit.runners.model.TestClass) Test(org.junit.Test)

Example 18 with TestClass

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

the class RuleMemberValidatorTest method rejectProtectedClassRule.

@Test
public void rejectProtectedClassRule() {
    TestClass target = new TestClass(TestWithProtectedClassRule.class);
    CLASS_RULE_VALIDATOR.validate(target, errors);
    assertOneErrorWithMessage("The @ClassRule 'temporaryFolder' must be public.");
}
Also used : TestClass(org.junit.runners.model.TestClass) Test(org.junit.Test)

Example 19 with TestClass

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

the class RuleMemberValidatorTest method rejectClassRuleThatReturnsImplementationOfMethodRule.

/**
     * If there is any method annotated with @ClassRule then it must return an 
     * implementation of {@link TestRule}
     * 
     * <p>This case has been added with 
     * <a href="https://github.com/junit-team/junit4/issues/1019">Issue #1019</a>
     */
@Test
public void rejectClassRuleThatReturnsImplementationOfMethodRule() {
    TestClass target = new TestClass(TestWithClassRuleMethodThatReturnsMethodRule.class);
    CLASS_RULE_METHOD_VALIDATOR.validate(target, errors);
    assertOneErrorWithMessage("The @ClassRule 'methodRule' must return an implementation of TestRule.");
}
Also used : TestClass(org.junit.runners.model.TestClass) Test(org.junit.Test)

Example 20 with TestClass

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

the class RuleMemberValidatorTest method methodAcceptMethodRuleMethod.

@Test
public void methodAcceptMethodRuleMethod() throws Exception {
    TestClass target = new TestClass(MethodTestWithMethodRule.class);
    RULE_METHOD_VALIDATOR.validate(target, errors);
    assertNumberOfErrors(0);
}
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