Package org.junit.runners.model

Examples of org.junit.runners.model.TestClass


        }
    }

    @Test
    public void errorIsAddedWhenCategoryIsUsedWithBeforeClass() {
        FrameworkMethod method = new TestClass(CategoryTest.class).getAnnotatedMethods(BeforeClass.class).get(0);
        testAndAssertErrorMessage(method, "@BeforeClass can not be combined with @Category");
    }
View Full Code Here


        testAndAssertErrorMessage(method, "@BeforeClass can not be combined with @Category");
    }

    @Test
    public void errorIsAddedWhenCategoryIsUsedWithAfterClass() {
        FrameworkMethod method = new TestClass(CategoryTest.class).getAnnotatedMethods(AfterClass.class).get(0);
        testAndAssertErrorMessage(method, "@AfterClass can not be combined with @Category");
    }
View Full Code Here

        testAndAssertErrorMessage(method, "@AfterClass can not be combined with @Category");
    }

    @Test
    public void errorIsAddedWhenCategoryIsUsedWithBefore() {
        FrameworkMethod method = new TestClass(CategoryTest.class).getAnnotatedMethods(Before.class).get(0);
        testAndAssertErrorMessage(method, "@Before can not be combined with @Category");
    }
View Full Code Here

        testAndAssertErrorMessage(method, "@Before can not be combined with @Category");
    }

    @Test
    public void errorIsAddedWhenCategoryIsUsedWithAfter() {
        FrameworkMethod method = new TestClass(CategoryTest.class).getAnnotatedMethods(After.class).get(0);
        testAndAssertErrorMessage(method, "@After can not be combined with @Category");
    }
View Full Code Here

    private TheoryTestUtils() { }
   
    public static List<PotentialAssignment> potentialAssignments(Method method)
            throws Throwable {
        return Assignments.allUnassigned(method,
                new TestClass(method.getDeclaringClass()))
                .potentialsForNextUnassigned();
    }
View Full Code Here

public class RuleMemberValidatorTest {
    private final List<Throwable> errors = new ArrayList<Throwable>();

    @Test
    public void rejectProtectedClassRule() {
        TestClass target = new TestClass(TestWithProtectedClassRule.class);
        CLASS_RULE_VALIDATOR.validate(target, errors);
        assertOneErrorWithMessage("The @ClassRule 'temporaryFolder' must be public.");
    }
View Full Code Here

        protected static TestRule temporaryFolder = new TemporaryFolder();
    }

    @Test
    public void rejectNonStaticClassRule() {
        TestClass target = new TestClass(TestWithNonStaticClassRule.class);
        CLASS_RULE_VALIDATOR.validate(target, errors);
        assertOneErrorWithMessage("The @ClassRule 'temporaryFolder' must be static.");
    }
View Full Code Here

        public TestRule temporaryFolder = new TemporaryFolder();
    }

    @Test
    public void acceptStaticTestRuleThatIsAlsoClassRule() {
        TestClass target = new TestClass(TestWithStaticClassAndTestRule.class);
        CLASS_RULE_VALIDATOR.validate(target, errors);
        assertNumberOfErrors(0);
    }
View Full Code Here

        public static TestRule temporaryFolder = new TemporaryFolder();
    }

    @Test
    public void rejectClassRuleInNonPublicClass() {
        TestClass target = new TestClass(NonPublicTestWithClassRule.class);
        CLASS_RULE_VALIDATOR.validate(target, errors);
        assertOneErrorWithMessage("The @ClassRule 'temporaryFolder' must be declared in a public class.");
    }
View Full Code Here

     * <p>This case has been added with
     * <a href="https://github.com/junit-team/junit/issues/1019">Issue #1019</a>
     */
    @Test
    public void rejectClassRuleThatIsImplemetationOfMethodRule() {
        TestClass target = new TestClass(TestWithClassRuleIsImplementationOfMethodRule.class);
        CLASS_RULE_VALIDATOR.validate(target, errors);
        assertOneErrorWithMessage("The @ClassRule 'classRule' must implement TestRule.");
    }
View Full Code Here

TOP

Related Classes of org.junit.runners.model.TestClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.