Package org.junit.runner

Examples of org.junit.runner.Description


    @Test
    public void preferRecentlyFailed38Test() {
        Request request = Request.classes(JUnit4Test.class, JUnit38Test.class);
        fMax.run(request);
        List<Description> tests = fMax.sortedLeavesForTest(request);
        Description dontSucceed = Description.createTestDescription(
                JUnit38Test.class, "testFails");
        assertEquals(dontSucceed, tests.get(0));
    }
View Full Code Here


    }

    @Test
    public void plansNamedCorrectly() throws Exception {
        Runner runner = Request.aClass(FibonacciTest.class).getRunner();
        Description description = runner.getDescription();
        assertEquals("[0: fib(0)=0]", description.getChildren().get(0)
                .getDisplayName());
    }
View Full Code Here

    @Test
    public void usesIndexAsTestName() {
        Runner runner = Request
                .aClass(ParameterizedWithoutSpecialTestname.class).getRunner();
        Description description = runner.getDescription();
        assertEquals("[1]", description.getChildren().get(1).getDisplayName());
    }
View Full Code Here

    }

    @Test
    public void plansNamedCorrectlyWithParameterizedField() throws Exception {
        Runner runner = Request.aClass(FibonacciWithParameterizedFieldTest.class).getRunner();
        Description description = runner.getDescription();
        assertEquals("[0]", description.getChildren().get(0).getDisplayName());
    }
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

        run = false;
        JUnitCore core = new JUnitCore();
        Result result = core.run(ErrorInBeforeClass.class);
        assertFalse(run);
        assertEquals(1, result.getFailureCount());
        Description description = result.getFailures().get(0).getDescription();
        assertEquals(ErrorInBeforeClass.class.getName(), description.getDisplayName());
    }
View Full Code Here

        JUnit38ClassRunner runner = new JUnit38ClassRunner(DerivedAnnotatedMethod.class);
        assertAnnotationFiltering(runner);
    }

    private void assertAnnotationFiltering(JUnit38ClassRunner runner) {
        Description d = runner.getDescription();
        assertEquals(2, d.testCount());
        for (Description methodDesc : d.getChildren()) {
            if (methodDesc.getMethodName().equals("testAnnotated")) {
                assertNotNull(methodDesc.getAnnotation(MyAnnotation.class));
            } else {
                assertNull(methodDesc.getAnnotation(MyAnnotation.class));
            }
View Full Code Here

    @Test
    public void descriptionAndRunNotificationsAreConsistent() {
        Result result = JUnitCore.runClasses(CompatibilityTest.class);
        assertEquals(0, result.getIgnoreCount());

        Description description = Request.aClass(CompatibilityTest.class).getRunner().getDescription();
        assertEquals(0, description.getChildren().size());
    }
View Full Code Here

    // Implementation of ParentRunner
    //

    @Override
    protected void runChild(final FrameworkMethod method, RunNotifier notifier) {
        Description description = describeChild(method);
        if (isIgnored(method)) {
            notifier.fireTestIgnored(description);
        } else {
            runLeaf(methodBlock(method), description, notifier);
        }
View Full Code Here

        return child.getAnnotation(Ignore.class) != null;
    }

    @Override
    protected Description describeChild(FrameworkMethod method) {
        Description description = methodDescriptions.get(method);

        if (description == null) {
            description = Description.createTestDescription(getTestClass().getJavaClass(),
                    testName(method), method.getAnnotations());
            methodDescriptions.putIfAbsent(method, description);
View Full Code Here

TOP

Related Classes of org.junit.runner.Description

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.