Package org.junit.runner

Examples of org.junit.runner.JUnitCore.run()


    }

    public void testErrorInAfterClass() throws Exception {
        run = false;
        JUnitCore core = new JUnitCore();
        Result result = core.run(ErrorInAfterClass.class);
        assertTrue(run);
        assertEquals(1, result.getFailureCount());
    }

    static public class SuperInheritance {
View Full Code Here


    }

    public void testOrderingOfInheritance() throws Exception {
        log = "";
        JUnitCore core = new JUnitCore();
        core.run(SubInheritance.class);
        assertEquals("Before class super Before class sub Before super Before sub Test After sub After super After class sub After class super ", log);
    }

    static public class SuperShadowing {
        @Before
View Full Code Here

    }

    public void testShadowing() throws Exception {
        log = "";
        JUnitCore core = new JUnitCore();
        core.run(SubShadowing.class);
        assertEquals("Before sub Test After sub ", log);
    }

    static public class SuperTest {
        @Test
View Full Code Here

    }

    public void testTestInheritance() throws Exception {
        log = "";
        JUnitCore core = new JUnitCore();
        core.run(SubTest.class);
        // The order in which the test methods are called is unspecified
        assertTrue(log.contains("Sub"));
        assertTrue(log.contains("Two"));
        assertFalse(log.contains("Super"));
    }
View Full Code Here

    }

    public void testRunAllAfters() {
        log = "";
        JUnitCore core = new JUnitCore();
        core.run(RunAllAfters.class);
        assertTrue(log.contains("one"));
        assertTrue(log.contains("two"));
    }

    static public class RunAllAftersRegardless {
View Full Code Here

    }

    public void testRunAllAftersRegardless() {
        log = "";
        JUnitCore core = new JUnitCore();
        Result result = core.run(RunAllAftersRegardless.class);
        assertTrue(log.contains("one"));
        assertTrue(log.contains("two"));
        assertEquals(2, result.getFailureCount());
    }
View Full Code Here

    }

    public void testRunAllAfterClasses() {
        log = "";
        JUnitCore core = new JUnitCore();
        core.run(RunAllAfterClasses.class);
        assertTrue(log.contains("one"));
        assertTrue(log.contains("two"));
    }

    static public class RunAllAfterClassesRegardless {
View Full Code Here

    }

    public void testRunAllAfterClassesRegardless() {
        log = "";
        JUnitCore core = new JUnitCore();
        Result result = core.run(RunAllAfterClassesRegardless.class);
        assertTrue(log.contains("one"));
        assertTrue(log.contains("two"));
        assertEquals(2, result.getFailureCount());
    }
}
View Full Code Here

    }

    @Test
    public void testErrorWhenTestHasParametersDespiteTheories() {
        JUnitCore core = new JUnitCore();
        Result result = core.run(ErrorWhenTestHasParametersDespiteTheories.class);
        assertEquals(1, result.getFailureCount());
        String message = result.getFailures().get(0).getMessage();
        assertThat(message, containsString("should have no parameters"));
    }
}
View Full Code Here

    public void testCountClassFiltering() throws Exception {
        JUnitCore junitCore = new JUnitCore();
        Request request = Request.aClass(ExampleTest.class);
        CountingFilter countingFilter = new CountingFilter();
        Request requestFiltered = request.filterWith(countingFilter);
        Result result = junitCore.run(requestFiltered);
        assertEquals(1, result.getRunCount());
        assertEquals(0, result.getFailureCount());

        Description desc = createTestDescription(ExampleTest.class, "test1");
        assertEquals(1, countingFilter.getCount(desc));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.