Package org.junit.runner

Examples of org.junit.runner.Result$Listener


        }
    }

    @Test
    public void numberOfFieldsAndParametersShouldMatch() {
        Result result = JUnitCore.runClasses(BadNumberOfAnnotatedFieldTest.class);
        assertEquals(1, result.getFailureCount());
        List<Failure> failures = result.getFailures();
        assertTrue(failures.get(0).getException().getMessage().contains("Wrong number of parameters and @Parameter fields. @Parameter fields counted: 1, available parameters: 2."));
    }
View Full Code Here


        }
    }

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

        }
    }

    @Test
    public void failuresAddedForBadTestMethod() throws Exception {
        Result result = JUnitCore.runClasses(IncorrectTest.class);
        assertEquals(1, result.getFailureCount());
    }
View Full Code Here

        }
    }

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

                exceptionMessageFrom(BadBeforeMethodWithLegacyRunner.class));
    }

    private String exceptionMessageFrom(Class<?> testClass) {
        JUnitCore core = new JUnitCore();
        Result result = core.run(testClass);
        Failure failure = result.getFailures().get(0);
        String message = failure.getException().getMessage();
        return message;
    }
View Full Code Here

        }
    }

    @Test
    public void runsForEverySingleArgumentOfArray() {
        Result result= JUnitCore.runClasses(SingleArgumentTestWithArray.class);
        assertEquals(2, result.getRunCount());
    }
View Full Code Here

        }
    }

    @Test
    public void runsForEverySingleArgumentOfIterable() {
        Result result= JUnitCore
                .runClasses(SingleArgumentTestWithIterable.class);
        assertEquals(2, result.getRunCount());
    }
View Full Code Here

                TestWithUseParametersRunnerFactoryAnnotation.class,
                "Called ExceptionThrowingRunnerFactory.");
    }

    private void assertTestCreatesSingleFailureWithMessage(Class<?> test, String message) {
        Result result = JUnitCore.runClasses(test);
        assertEquals(1, result.getFailures().size());
        assertEquals(message, result.getFailures().get(0).getMessage());
    }
View Full Code Here

        }
    }

    @Test
    public void nonStaticBeforeClass() {
        Result result = JUnitCore.runClasses(NonStaticBeforeClass.class);
        assertEquals("Method before() should be static", result.getFailures().get(0).getMessage());
    }
View Full Code Here

        Assume.assumeTrue(false);
    }

    @Test
    public void theoryMeansOnlyAssumeShouldFail() throws InitializationError {
        Result result = runTheoryClass(TheoryWithNoUnassumedParameters.class);
        Assert.assertEquals(1, result.getFailureCount());
    }
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.