Package org.junit.runner

Examples of org.junit.runner.Result.wasSuccessful()


    }

    @Test
    public void slowTests() {
        Result testResult= JUnitCore.runClasses(SlowTestSuite.class);
        assertTrue(testResult.wasSuccessful());
        assertThat("unexpected run count", testResult.getRunCount(), is(2));
        assertThat("unexpected failure count", testResult.getFailureCount(), is(0));
    }

    @Test
View Full Code Here


    }

    @Test
    public void fastSmokeTests() {
        Result testResult= JUnitCore.runClasses(FastOrSmokeTestSuite.class);
        assertTrue(testResult.wasSuccessful());
        assertThat("unexpected run count", testResult.getRunCount(), is(2));
        assertThat("unexpected failure count", testResult.getFailureCount(), is(0));
    }
}
View Full Code Here

    }

    @Test
    public void suiteShouldBeOKwithNonDefaultConstructor() throws Exception {
        Result result = JUnitCore.runClasses(WithoutDefaultConstructor.class);
        assertTrue(result.wasSuccessful());
    }

    @RunWith(Suite.class)
    public class NoSuiteClassesAnnotation {
    }
View Full Code Here

    @Test
    public void customRuleIsAppliedOnce() {
        ExampleTestWithCustomClassRule.counter.count = 0;
        Result result = JUnitCore.runClasses(ExampleTestWithCustomClassRule.class);
        assertTrue(result.wasSuccessful());
        assertEquals(1, ExampleTestWithCustomClassRule.counter.count);
    }

    private static final List<String> orderList = new LinkedList<String>();
View Full Code Here

    @Test
    public void methodCustomRuleIsAppliedOnce() {
        MethodExampleTestWithCustomClassRule.counter.count = 0;
        Result result = JUnitCore.runClasses(MethodExampleTestWithCustomClassRule.class);
        assertTrue(result.wasSuccessful());
        assertEquals(1, MethodExampleTestWithCustomClassRule.counter.count);
    }

    public static class CallMethodOnlyOnceRule {
        static int countOfMethodCalls = 0;
View Full Code Here

    @Test
    public void testCountOnAWithoutSlowTests() {
        Result result = JUnitCore.runClasses(SomeAreSlowSuite.class);
        assertThat(testResult(SomeAreSlowSuite.class), isSuccessful());
        assertEquals(2, result.getRunCount());
        assertTrue(result.wasSuccessful());
    }

    @RunWith(Categories.class)
    @ExcludeCategory(Category1.class)
    @IncludeCategory(Category2.class)
View Full Code Here

    @Test
    public void testsThatAreBothIncludedAndExcludedAreExcluded() {
        Result result = JUnitCore.runClasses(IncludeAndExcludeSuite.class);
        assertEquals(1, result.getRunCount());
        assertTrue(result.wasSuccessful());
    }

    @RunWith(Suite.class)
    @SuiteClasses({A.class, B.class, C.class})
    public static class TestSuiteWithNoCategories {
View Full Code Here

    @Test
    public void testCountWithExplicitFilter() throws Throwable {
        CategoryFilter include = CategoryFilter.include(SlowTests.class);
        Request baseRequest = Request.aClass(TestSuiteWithNoCategories.class);
        Result result = new JUnitCore().run(baseRequest.filterWith(include));
        assertTrue(result.wasSuccessful());
        assertEquals(2, result.getRunCount());
    }

    @Test
    public void categoryFilterLeavesOnlyMatchingMethods()
View Full Code Here

    @Test
    public void ifNoTestsToRunUseErrorRunner() {
        Result result = JUnitCore.runClasses(OneFastSuite.class);
        assertEquals(1, result.getRunCount());
        assertEquals(1, result.getFailureCount());
        assertFalse(result.wasSuccessful());
    }

    @Test
    public void describeACategoryFilter() {
        CategoryFilter filter = CategoryFilter.include(SlowTests.class);
View Full Code Here

    @Test
    public void testInheritance() {
        Result result = JUnitCore.runClasses(InheritanceSuite.class);
        assertEquals(1, result.getRunCount());
        assertTrue(result.wasSuccessful());
    }

    @RunWith(Categories.class)
    @IncludeCategory(Runnable.class)
    @ExcludeCategory(Runnable.class)
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.