Package org.junit.runner

Examples of org.junit.runner.Result


        Assume.assumeTrue(false);
    }

    @Test
    public void theoryMeansOnlyAssumeShouldFail() throws InitializationError {
        Result result = runTheoryClass(TheoryWithNoUnassumedParameters.class);
        Assert.assertEquals(1, result.getFailureCount());
    }
View Full Code Here


    }

    @Test
    public void freshResultEachTime() {
        JUnitCore core = new JUnitCore();
        Result first = core.run(OneTest.class);
        Result second = core.run(OneTest.class);
        assertNotSame(first, second);
    }
View Full Code Here

        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

    }

    private void assertClassHasFailureMessage(Class<?> klass, String message) {
        JUnitCore junitCore = new JUnitCore();
        Request request = Request.aClass(klass);
        Result result = junitCore.run(request);
        assertThat(result.getFailureCount(), is(2)); //the second failure is no runnable methods
        assertThat(result.getFailures().get(0).getMessage(),
                is(equalTo(message)));
    }
View Full Code Here

    }

    @Test
    public void canUnadaptAnAdapter() {
        JUnit38ClassRunner runner = new JUnit38ClassRunner(new JUnit4TestAdapter(AnnotatedTest.class));
        Result result = new JUnitCore().run(runner);
        Failure failure = result.getFailures().get(0);
        assertEquals(Description.createTestDescription(AnnotatedTest.class, "foo"), failure.getDescription());
    }
View Full Code Here

            }
        };

        runner.addListener(listener);
        count = 0;
        Result result = runner.run(OneTest.class);
        assertEquals(1, count);
        assertEquals(1, result.getRunCount());
    }
View Full Code Here

        }
    }

    @Test
    public void invalidTestMethodReportedCorrectly() {
        Result result = JUnitCore.runClasses(ClassWithInvalidMethod.class);
        Failure failure = result.getFailures().get(0);
        assertEquals("warning", failure.getDescription().getMethodName());
        assertEquals("junit.framework.TestSuite$1", failure.getDescription().getClassName());
    }
View Full Code Here

    }

    @Test
    public void failureWithTimeout() throws Exception {
        JUnitCore core = new JUnitCore();
        Result result = core.run(FailureWithTimeoutTest.class);
        assertEquals(1, result.getRunCount());
        assertEquals(1, result.getFailureCount());
        assertEquals(AssertionError.class, result.getFailures().get(0).getException().getClass());
    }
View Full Code Here

        fTwo = null;
    }

    @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

    }

    @Test
    public void failureWithTimeoutRunTimeException() throws Exception {
        JUnitCore core = new JUnitCore();
        Result result = core.run(FailureWithTimeoutRunTimeExceptionTest.class);
        assertEquals(1, result.getRunCount());
        assertEquals(1, result.getFailureCount());
        assertEquals(NullPointerException.class, result.getFailures().get(0).getException().getClass());
    }
View Full Code Here

TOP

Related Classes of org.junit.runner.Result

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.