Package org.junit.runner

Examples of org.junit.runner.JUnitCore


    @Test
    public void parameterizedFilterToSingleMethod() throws Exception {
        count = 0;
        Runner runner = Request.method(ParameterizedOneTimeSetup.class,
                "one[0]").getRunner();
        Result result = new JUnitCore().run(runner);

        assertEquals(1, result.getRunCount());
    }
View Full Code Here


        assertEquals(1, runner.testCount());
    }

    @Test
    public void nonexistentMethodCreatesFailure() throws Exception {
        assertEquals(1, new JUnitCore().run(
                Request.method(OneTimeSetup.class, "thisMethodDontExist"))
                .getFailureCount());
    }
View Full Code Here

        }
    }

    @org.junit.Test
    public void ensureTestIsRun() {
        JUnitCore runner = new JUnitCore();
        run = false; // Have to explicitly set run here because the runner might independently run OneTest above
        runner.run(All.class);
        assertTrue(run);
    }
View Full Code Here

        }
    }

    @Test
    public void newTestCount() {
        JUnitCore runner = new JUnitCore();
        MyListener listener = new MyListener();
        runner.addListener(listener);
        runner.run(Example.class);
        assertEquals(1, listener.testCount);
    }
View Full Code Here

        }
    }

    @Test
    public void oldTestCount() {
        JUnitCore runner = new JUnitCore();
        MyListener listener = new MyListener();
        runner.addListener(listener);
        runner.run(ExampleTest.class);
        assertEquals(1, listener.testCount);
    }
View Full Code Here

        }
    }

    @Test
    public void testFinished() {
        JUnitCore runner = new JUnitCore();
        wasRun = false;
        RunListener listener = new MyListener() {
            @Override
            public void testFinished(Description description) {
                wasRun = true;
            }
        };
        runner.addListener(listener);
        runner.run(NewExample.class);
        assertTrue(wasRun);
    }
View Full Code Here

        Assert.assertFalse("Should not be debugging", subject.isDebugging());
    }

    @Test
    public void whenRunWithPreJava5DebugArgumentsTestShouldFail() {
        JUnitCore core = new JUnitCore();
        Result result = core.run(PreJava5DebugArgumentsTest.class);
        assertEquals("Should run the test", 1, result.getRunCount());
        assertEquals("Test should not have failed", 0, result.getFailureCount());
    }
View Full Code Here

        assertEquals("Test should not have failed", 0, result.getFailureCount());
    }

    @Test
    public void whenRunWithPreJava5DebugArgumentsInReverseOrderTestShouldFail() {
        JUnitCore core = new JUnitCore();
        Result result = core
                .run(PreJava5DebugArgumentsReversedTest.class);
        assertEquals("Should run the test", 1, result.getRunCount());
        assertEquals("Test should not have failed", 0, result.getFailureCount());
    }
View Full Code Here

        assertEquals("Test should not have failed", 0, result.getFailureCount());
    }

    @Test
    public void whenRunWithPostJava5DebugArgumentsTestShouldFail() {
        JUnitCore core = new JUnitCore();
        Result result = core.run(PostJava5DebugArgumentsTest.class);
        assertEquals("Should run the test", 1, result.getRunCount());
        assertEquals("Test should not have failed", 0, result.getFailureCount());
    }
View Full Code Here

        assertEquals("Test should not have failed", 0, result.getFailureCount());
    }

    @Test
    public void whenRunWithoutDebugFlagsTestShouldPass() {
        JUnitCore core = new JUnitCore();
        Result result = core.run(WithoutDebugArgumentsTest.class);
        assertEquals("Should run the test", 1, result.getRunCount());
        assertEquals("Test should have failed", 1, result.getFailureCount());
    }
View Full Code Here

TOP

Related Classes of org.junit.runner.JUnitCore

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.