Package org.junit.runner

Examples of org.junit.runner.Result$Listener


    public static class OneFastSuite {
    }

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


        }
    }

    @Test
    public void allIncludedSuiteCategoriesMustBeMatched() {
        Result result= JUnitCore.runClasses(AllIncludedMustBeMatchedSuite.class);
        assertEquals(1, result.getRunCount());
        assertEquals(0, result.getFailureCount());
    }
View Full Code Here

        }
    }

    @Test
    public void anyMethodWithExcludedCategoryWillBeExcluded() {
        Result result= JUnitCore.runClasses(MultiIncludeWithExcludeCategorySuite.class);
        assertEquals(1, result.getRunCount());
        assertEquals(0, result.getFailureCount());
    }
View Full Code Here

        }
    }

    @Test
    public void ignoreClass() {
        Result result = JUnitCore.runClasses(IgnoreMe.class);
        assertEquals(0, result.getFailureCount());
        assertEquals(1, result.getIgnoreCount());
    }
View Full Code Here

    @SuiteClasses(Inherited.class)
    public interface InheritanceSuite {}

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

    public static class IgnoredTestCategoriesSuite {
    }

    @Test
    public void ignoredTest() {// behaves same as Suite
        Result result= JUnitCore.runClasses(IgnoredTestCategoriesSuite.class);
        assertFalse(result.wasSuccessful());
        assertThat(result.getRunCount(), is(1));
        assertThat(result.getFailureCount(), is(1));
        assertThat(result.getIgnoreCount(), is(1));
    }
View Full Code Here

    public static class IncludedExcludedSameSuite {
    }

    @Test
    public void oneRunnableOthersAvoided() {
        Result result= JUnitCore.runClasses(IncludedExcludedSameSuite.class);
        assertEquals(1, result.getRunCount());
        assertTrue(result.wasSuccessful());
    }
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 testCountWithMultipleExcludeFilter() throws Throwable {
        Set<Class<?>> exclusions= new HashSet<Class<?>>(2);
        Collections.addAll(exclusions, SlowTests.class, FastTests.class);
        CategoryFilter exclude = CategoryFilter.categoryFilter(true, null, true, exclusions);
        Request baseRequest= Request.aClass(OneOfEach.class);
        Result result= new JUnitCore().run(baseRequest.filterWith(exclude));
        assertTrue(result.wasSuccessful());
        assertEquals(1, result.getRunCount());
    }
View Full Code Here

    @Test
    public void testCountWithMultipleIncludeFilter() throws Throwable {
        CategoryFilter exclude = CategoryFilter.include(true, SlowTests.class, FastTests.class);
        Request baseRequest= Request.aClass(OneOfEach.class);
        Result result= new JUnitCore().run(baseRequest.filterWith(exclude));
        assertTrue(result.wasSuccessful());
        assertEquals(2, result.getRunCount());
    }
View Full Code Here

TOP

Related Classes of org.junit.runner.Result$Listener

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.