Examples of JUnitCore


Examples of org.junit.runner.JUnitCore

    }

    public void testTwoTests() throws Exception {
        count = 0;
        tests = new HashSet<Object>();
        JUnitCore runner = new JUnitCore();
        runner.run(TwoTests.class);
        assertEquals(2, count);
        assertEquals(2, tests.size());
    }
View Full Code Here

Examples of org.junit.runner.JUnitCore

            run = true;
        }
    }

    public void testOldTest() throws Exception {
        JUnitCore runner = new JUnitCore();
        runner.run(OldTest.class);
        assertTrue(run);
    }
View Full Code Here

Examples of org.junit.runner.JUnitCore

        }
    }

    public void testOldSuiteTest() throws Exception {
        TestSuite suite = new TestSuite(OldSuiteTest.class);
        JUnitCore runner = new JUnitCore();
        runner.run(suite);
        assertTrue(run);
    }
View Full Code Here

Examples of org.junit.runner.JUnitCore

            throw new Error();
        }
    }

    public void testException() throws Exception {
        JUnitCore core = new JUnitCore();
        Result result = core.run(ExceptionTest.class);
        assertEquals(0, result.getFailureCount());
    }
View Full Code Here

Examples of org.junit.runner.JUnitCore

        public void expectedException() {
        }
    }

    public void testExceptionNotThrown() throws Exception {
        JUnitCore core = new JUnitCore();
        Result result = core.run(NoExceptionTest.class);
        assertEquals(1, result.getFailureCount());
        assertEquals("Expected exception: java.lang.Error", result.getFailures().get(0).getMessage());
    }
View Full Code Here

Examples of org.junit.runner.JUnitCore

        }
    }

    public void testOneTimeSetup() throws Exception {
        count = 0;
        JUnitCore core = new JUnitCore();
        core.run(OneTimeSetup.class);
        assertEquals(1, count);
    }
View Full Code Here

Examples of org.junit.runner.JUnitCore

        @Test
        public void sortingForwardWorksOnTestClassRunner() {
            Request forward = Request.aClass(SortMe.class).sortWith(forward());

            new JUnitCore().run(forward);
            assertEquals("abc", log);
        }
View Full Code Here

Examples of org.junit.runner.JUnitCore

        @Test
        public void sortingBackwardWorksOnTestClassRunner() {
            Request backward = Request.aClass(SortMe.class).sortWith(backward());

            new JUnitCore().run(backward);
            assertEquals("cba", log);
        }
View Full Code Here

Examples of org.junit.runner.JUnitCore

        }

        @Test
        public void unsortablesAreHandledWithoutCrashing() {
            Request unsorted = Request.aClass(Unsortable.class).sortWith(forward());
            new JUnitCore().run(unsorted);
        }
View Full Code Here

Examples of org.junit.runner.JUnitCore

        assertEquals("before apple after before banana after afterAll ", log);
    }

    @Test
    public void testMultipleFilters() throws Exception {
        JUnitCore junitCore = new JUnitCore();
        Request request = Request.aClass(ExampleTest.class);
        Request requestFiltered = request.filterWith(new Exclude("test1"));
        Request requestFilteredFiltered = requestFiltered
                .filterWith(new Exclude("test2"));
        Result result = junitCore.run(requestFilteredFiltered);
        assertThat(result.getFailures(), isEmpty());
        assertEquals(1, result.getRunCount());
    }
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.