Search in sources :

Example 11 with TestClass

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

the class TestWithParametersTest method isNotEqualToTestWithDifferentTestClass.

@Test
public void isNotEqualToTestWithDifferentTestClass() {
    TestWithParameters firstTest = new TestWithParameters(DUMMY_NAME, new TestClass(DummyClass.class), DUMMY_PARAMETERS);
    TestWithParameters secondTest = new TestWithParameters(DUMMY_NAME, new TestClass(AnotherDummyClass.class), DUMMY_PARAMETERS);
    assertNotEquals(firstTest, secondTest);
}
Also used : TestClass(org.junit.runners.model.TestClass) Test(org.junit.Test)

Example 12 with TestClass

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

the class RuleMemberValidatorTest method rejectStaticMethodRule.

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

Example 13 with TestClass

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

the class RuleMemberValidatorTest method rejectMethodStaticTestRule.

@Test
public void rejectMethodStaticTestRule() {
    TestClass target = new TestClass(TestMethodWithStaticTestRule.class);
    RULE_METHOD_VALIDATOR.validate(target, errors);
    assertOneErrorWithMessage("The @Rule 'getTemporaryFolder' must not be static or it must be annotated with @ClassRule.");
}
Also used : TestClass(org.junit.runners.model.TestClass) Test(org.junit.Test)

Example 14 with TestClass

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

the class RuleMemberValidatorTest method rejectStaticTestRule.

@Test
public void rejectStaticTestRule() {
    TestClass target = new TestClass(TestWithStaticTestRule.class);
    RULE_VALIDATOR.validate(target, errors);
    assertOneErrorWithMessage("The @Rule 'temporaryFolder' must not be static or it must be annotated with @ClassRule.");
}
Also used : TestClass(org.junit.runners.model.TestClass) Test(org.junit.Test)

Example 15 with TestClass

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

the class RuleMemberValidatorTest method rejectClassRuleIsAnArbitraryObject.

/**
     * If there is any property annotated with @ClassRule then it must implement
     * {@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 rejectClassRuleIsAnArbitraryObject() throws Exception {
    TestClass target = new TestClass(TestWithClassRuleIsAnArbitraryObject.class);
    CLASS_RULE_VALIDATOR.validate(target, errors);
    assertOneErrorWithMessage("The @ClassRule 'arbitraryObject' must implement TestRule.");
}
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