Package org.junit.runner

Examples of org.junit.runner.Result$Listener


    @Test
    public void hasNoProblemsWithFailingListeners() { // see issues 209 and 395
        fNotifier.addListener(new CorruptListener());
        fNotifier.addListener(new FailureListener());
        fNotifier.addListener(new CorruptListener());
        fNotifier.fireTestRunFinished(new Result());
    }
View Full Code Here


        assertThat("unexpected failure count", testResult.getIgnoreCount(), is(equalTo(0)));
    }

    @Test
    public void inheritanceAllIncluded() {
        Result testResult= JUnitCore.runClasses(InheritanceAll.class);
        assertThat("unexpected run count", testResult.getRunCount(), is(equalTo(1)));
        assertThat("unexpected failure count", testResult.getFailureCount(), is(equalTo(0)));
        assertThat("unexpected failure count", testResult.getIgnoreCount(), is(equalTo(0)));
    }
View Full Code Here

        }
    }

    @Test
    public void count() {
        Result result = JUnitCore.runClasses(FibonacciTest.class);
        assertEquals(7, result.getRunCount());
        assertEquals(6, result.getFailureCount());
    }
View Full Code Here

        assertEquals(6, result.getFailureCount());
    }

    @Test
    public void failuresNamedCorrectly() {
        Result result = JUnitCore.runClasses(FibonacciTest.class);
        assertEquals(
                "test[1: fib(1)=1](" + FibonacciTest.class.getName() + ")",
                result.getFailures().get(0).getTestHeader());
    }
View Full Code Here

        }
    }

    @Test
    public void failedConstructionIsTestFailure() {
        Result result = JUnitCore.runClasses(CantConstruct.class);
        Failure failure = result.getFailures().get(0);
        Description expected = Description.createTestDescription(CantConstruct.class, "foo");
        Assert.assertEquals(expected, failure.getDescription());
    }
View Full Code Here

        }
    }

    @Test
    public void countWithParameterizedField() {
        Result result = JUnitCore.runClasses(FibonacciWithParameterizedFieldTest.class);
        assertEquals(7, result.getRunCount());
        assertEquals(6, result.getFailureCount());
    }
View Full Code Here

        assertThat("unexpected failure count", testResult.getIgnoreCount(), is(equalTo(0)));
    }

    @Test
    public void inheritanceAnyAll() {//any included, all excluded
        Result testResult= JUnitCore.runClasses(InheritanceAnyAll.class);
        assertThat("unexpected run count", testResult.getRunCount(), is(equalTo(3)));
        assertThat("unexpected failure count", testResult.getFailureCount(), is(equalTo(0)));
        assertThat("unexpected failure count", testResult.getIgnoreCount(), is(equalTo(0)));
    }
View Full Code Here

        assertThat("unexpected failure count", testResult.getIgnoreCount(), is(equalTo(0)));
    }

    @Test
    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());
    }
View Full Code Here

        assertEquals(6, result.getFailureCount());
    }

    @Test
    public void failuresNamedCorrectlyWithParameterizedField() {
        Result result = JUnitCore.runClasses(FibonacciWithParameterizedFieldTest.class);
        assertEquals(String
                .format("test[1](%s)", FibonacciWithParameterizedFieldTest.class.getName()), result
                .getFailures().get(0).getTestHeader());
    }
View Full Code Here

        }
    }

    @Test
    public void failureOnInitialization() {
        Result result = JUnitCore.runClasses(BadIndexForAnnotatedFieldTest.class);
        assertEquals(2, result.getFailureCount());
        List<Failure> failures = result.getFailures();
        assertEquals("Invalid @Parameter value: 2. @Parameter fields counted: 1. Please use an index between 0 and 0.",
                failures.get(0).getException().getMessage());
        assertEquals("@Parameter(0) is never used.", failures.get(1).getException().getMessage());
    }
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.