Package org.junit.runner

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


    }

    @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


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

    @Test
    @SuppressWarnings("unchecked")
    public void testCountWithMultipleExcludeFilter() throws Throwable {
View Full Code Here

        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());
    }

    @Test
    public void testCountWithMultipleIncludeFilter() throws Throwable {
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());
    }

    @RunWith(Categories.class)
    @Categories.ExcludeCategory(String.class)
View Full Code Here

    }

    @Test
    public void noIncludeCategoryAnnotation() {
        Result testResult= JUnitCore.runClasses(NoIncludeCategoryAnnotationSuite.class);
        assertTrue(testResult.wasSuccessful());
        assertEquals(1, testResult.getRunCount());
    }

    @RunWith(Categories.class)
    @Categories.IncludeCategory(CharSequence.class)
View Full Code Here

    }

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

    }

    @Test
    public void testsRunInParallel() {
        Result result = JUnitCore.runClasses(ParallelComputer.classes(), Example1.class, Example2.class);
        assertTrue(result.wasSuccessful());
        assertNotNull(fExample1One);
        assertNotNull(fExample1Two);
        assertNotNull(fExample2One);
        assertNotNull(fExample2Two);
        assertThat(fExample1One, is(fExample1Two));
View Full Code Here

    }

    @Test
    public void subclassWithOnlyInheritedTestsRuns() {
        Result result = JUnitCore.runClasses(Sub.class);
        assertTrue(result.wasSuccessful());
    }

    public static class SubWithBefore extends Super {
        @Before
        public void gack() {
View Full Code Here

    public void inheritanceAllAny() {//all included, any excluded
        Result testResult= JUnitCore.runClasses(InheritanceAllAny.class);
        assertThat("unexpected run count", testResult.getRunCount(), is(equalTo(1)));
        assertThat("unexpected failure count", testResult.getFailureCount(), is(equalTo(1)));
        assertThat("unexpected failure count", testResult.getIgnoreCount(), is(equalTo(0)));
        assertFalse(testResult.wasSuccessful());
    }

    public static class X implements A {}
    public static class Y implements B {}
    public static class Z implements A, B {}
View Full Code Here

    }

    @Test
    public void testsRunInParallel() {
        Result result = JUnitCore.runClasses(ParallelComputer.methods(), Example.class);
        assertTrue(result.wasSuccessful());
        assertNotNull(fOne);
        assertNotNull(fTwo);
        assertThat(fOne, is(not(fTwo)));
    }
}
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.