FileDocCategorySizeDatePackage
JUnitTestListenerTest.javaAPI DocApache Ant 1.702856Wed Dec 13 06:16:22 GMT 2006org.apache.tools.ant.taskdefs.optional.junit

JUnitTestListenerTest

public class JUnitTestListenerTest extends org.apache.tools.ant.BuildFileTest

Fields Summary
private static final String
PASS_TEST_TARGET
private static final String
PASS_TEST
Constructors Summary
public JUnitTestListenerTest(String name)


       
        super(name);
    
Methods Summary
private booleanhasBuildListenerEvents(java.lang.String log)

        return log.indexOf(JUnitTask.TESTLISTENER_PREFIX) >= 0;
    
private booleanhasEventMessage(java.lang.String eventPrefix)

	return getFullLog().indexOf(eventPrefix) >= 0;
    
public voidsetUp()

        configureProject("src/etc/testcases/taskdefs/optional/junit.xml");
    
public voidtestEndTestFired()

        executeTarget(PASS_TEST_TARGET);
	assertTrue("expecting test ended message",
		   hasEventMessage(JUnitTask.TESTLISTENER_PREFIX + 
				   "endTest(" + PASS_TEST + ")"));
    
public voidtestFullLogOutput()

        executeTarget(PASS_TEST_TARGET);
        assertTrue("expecting full log to have BuildListener events", 
                   hasBuildListenerEvents(getFullLog()));
    
public voidtestNoLogOutput()

        executeTarget(PASS_TEST_TARGET);
        assertFalse("expecting log to not have BuildListener events", 
                    hasBuildListenerEvents(getLog()));
    
public voidtestStartTestFired()

        executeTarget(PASS_TEST_TARGET);
	assertTrue("expecting test started message",
		   hasEventMessage(JUnitTask.TESTLISTENER_PREFIX + 
				   "startTest(" + PASS_TEST + ")"));
    
public voidtestTestCountFired()

        executeTarget(PASS_TEST_TARGET);
	assertTrue("expecting test count message",
		   hasEventMessage(JUnitTask.TESTLISTENER_PREFIX + 
				   "tests to run: "));