Package org.apache.maven.surefire.junit4

Examples of org.apache.maven.surefire.junit4.JUnit4TestCheckerTest$CustomSuiteOnlyTest


{
    public void testTestRunStarted()
        throws Exception
    {
        RunListener jUnit4TestSetReporter =
            new JUnitCoreRunListener( new MockReporter(), new HashMap<String, TestSet>() );
        JUnitCore core = new JUnitCore();
        core.addListener( jUnit4TestSetReporter );
        Result result = core.run( new Computer(), STest1.class, STest2.class );
        core.removeListener( jUnit4TestSetReporter );
        assertEquals( 2, result.getRunCount() );
View Full Code Here


    public void testFailedAssumption()
        throws Exception
    {
        RunListener jUnit4TestSetReporter =
            new JUnitCoreRunListener( new MockReporter(), new HashMap<String, TestSet>() );
        JUnitCore core = new JUnitCore();
        core.addListener( jUnit4TestSetReporter );
        Result result = core.run( new Computer(), TestWithAssumptionFailure.class );
        core.removeListener( jUnit4TestSetReporter );
        assertEquals( 1, result.getRunCount() );
View Full Code Here

        Description st2 = Description.createSuiteDescription( STest2.class);
  //      st2.addChild( Description.createSuiteDescription( STest2.class ) );
        testDescription.addChild( st2 );

        Map<String, TestSet> classMethodCounts = new HashMap<String, TestSet>();
        JUnitCoreRunListener listener = new JUnitCoreRunListener( new MockReporter(), classMethodCounts );
        listener.testRunStarted( testDescription );
        assertEquals( 2, classMethodCounts.size() );
        Iterator<TestSet> iterator = classMethodCounts.values().iterator();
        assertFalse(iterator.next().equals( iterator.next() ));
View Full Code Here

        // assert that the test class is not visible by the JUnit classloader
        assertNull( testDescription.getTestClass() );
        Description suiteDescription = Description.createSuiteDescription( "testSuite" );
        suiteDescription.addChild( testDescription );
        Map<String, TestSet> classMethodCounts = new HashMap<String, TestSet>();
        JUnitCoreRunListener listener = new JUnitCoreRunListener( new MockReporter(), classMethodCounts );
        listener.testRunStarted( suiteDescription );
        assertEquals( 1, classMethodCounts.size() );
        TestSet testSet = classMethodCounts.get( "cannot.be.loaded.by.junit.Test" );
        assertNotNull( testSet );
    }
View Full Code Here

{
    @Test
    public void testTestStarted()
        throws Exception
    {
        RunListener jUnit4TestSetReporter = new JUnit4RunListener( new MockReporter() );
        Runner junitTestRunner = Request.classes( "abc", STest1.class, STest2.class ).getRunner();
        RunNotifier runNotifier = new RunNotifier();
        runNotifier.addListener( jUnit4TestSetReporter );
        junitTestRunner.run( runNotifier );
    }
View Full Code Here

    @Test
    public void testParallelInvocations()
        throws Exception
    {
        final MockReporter reporter = new MockReporter();
        final RunListener jUnit4TestSetReporter = new JUnit4RunListener( reporter );
        final CountDownLatch countDownLatch = new CountDownLatch( 1 );
        final Description testSomething = Description.createTestDescription( STest1.class, "testSomething" );
        final Description testSomething2 = Description.createTestDescription( STest2.class, "testSomething2" );

        jUnit4TestSetReporter.testStarted( testSomething );

        new Thread( new Runnable()
        {
            public void run()
            {
                try
                {
                    jUnit4TestSetReporter.testStarted( testSomething2 );
                    jUnit4TestSetReporter.testFailure( new Failure( testSomething2, new AssertionError( "Fud" ) ) );
                    jUnit4TestSetReporter.testFinished( testSomething2 );
                    countDownLatch.countDown();
                }
                catch ( Exception e )
                {
                    throw new RuntimeException( e );
                }
            }
        } ).start();

        countDownLatch.await();
        jUnit4TestSetReporter.testFinished( testSomething );

        Assert.assertEquals( "Failing tests", 1, reporter.getTestFailed() );
        Assert.assertEquals( "Succeeded tests", 1, reporter.getTestSucceeded() );
    }
View Full Code Here

{
    public void testTestRunStarted()
        throws Exception
    {
        RunListener jUnit4TestSetReporter =
            new JUnitCoreRunListener( new MockReporter(), new HashMap<String, TestSet>() );
        JUnitCore core = new JUnitCore();
        core.addListener( jUnit4TestSetReporter );
        Result result = core.run( new Computer(), STest1.class, STest2.class );
        core.removeListener( jUnit4TestSetReporter );
        assertEquals( 2, result.getRunCount() );
View Full Code Here

    public void testFailedAssumption()
        throws Exception
    {
        RunListener jUnit4TestSetReporter =
            new JUnitCoreRunListener( new MockReporter(), new HashMap<String, TestSet>() );
        JUnitCore core = new JUnitCore();
        core.addListener( jUnit4TestSetReporter );
        Result result = core.run( new Computer(), TestWithAssumptionFailure.class );
        core.removeListener( jUnit4TestSetReporter );
        assertEquals( 1, result.getRunCount() );
View Full Code Here

TOP

Related Classes of org.apache.maven.surefire.junit4.JUnit4TestCheckerTest$CustomSuiteOnlyTest

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.