Methods Summary |
---|
private void | assertNoPrint(java.lang.String result, java.lang.String where)
assertTrue(where + " '" + result + "' must not contain print statement",
result.indexOf("print to System.") == -1);
|
private void | assertOutput()
FileReader inner = new FileReader(getProject()
.resolveFile("testlog.txt"));
BufferedReader reader = new BufferedReader(inner);
try {
String line = reader.readLine();
assertEquals("Testsuite: org.apache.tools.ant.taskdefs.optional.junit.Printer",
line);
line = reader.readLine();
assertNotNull(line);
assertTrue(line.startsWith("Tests run: 1, Failures: 0, Errors: 0, Time elapsed:"));
line = reader.readLine();
assertEquals("------------- Standard Output ---------------",
line);
assertPrint(reader.readLine(), "static", "out");
assertPrint(reader.readLine(), "constructor", "out");
assertPrint(reader.readLine(), "method", "out");
line = reader.readLine();
assertEquals("------------- ---------------- ---------------",
line);
line = reader.readLine();
assertEquals("------------- Standard Error -----------------",
line);
assertPrint(reader.readLine(), "static", "err");
assertPrint(reader.readLine(), "constructor", "err");
assertPrint(reader.readLine(), "method", "err");
line = reader.readLine();
assertEquals("------------- ---------------- ---------------",
line);
line = reader.readLine();
assertEquals("", line);
line = reader.readLine();
assertNotNull(line);
assertTrue(line.startsWith("Testcase: testNoCrash took "));
} finally {
inner.close();
}
|
private void | assertPrint(java.lang.String line, java.lang.String from, java.lang.String to)
String search = from + " print to System." + to;
assertEquals(search, line);
|
private void | assertResultFileExists(java.lang.String classNameFragment, java.lang.String ext)
assertTrue("result for " + classNameFragment + "Test" + ext + " exists",
getProject().resolveFile("out/TEST-org.apache.tools.ant."
+ "taskdefs.optional.junit."
+ classNameFragment + "Test" + ext)
.exists());
|
private void | assertResultFilesExist(java.lang.String target, java.lang.String extension)
executeTarget(target);
assertResultFileExists("JUnitClassLoader", extension);
assertResultFileExists("JUnitTestRunner", extension);
assertResultFileExists("JUnitVersionHelper", extension);
|
public void | setUp()The JUnit setup method
configureProject("src/etc/testcases/taskdefs/optional/junit.xml");
|
public void | tearDown()The teardown method for JUnit
executeTarget("cleanup");
|
public void | testBatchTestForkOnceCustomFormatter()
assertResultFilesExist("testBatchTestForkOnceCustomFormatter", "foo");
|
public void | testBatchTestForkOnceExtension()Bugzilla Report 32973
assertResultFilesExist("testBatchTestForkOnceExtension", ".foo");
|
public void | testBatchTestForkOnceToDir()
assertResultFilesExist("testBatchTestForkOnceToDir", ".xml");
|
public void | testCrash()
expectPropertySet("crash", "crashed");
|
public void | testForkedCapture()
getProject().setProperty("fork", "true");
testNonForkedCapture();
// those would fail because of the way BuildFileTest captures output
assertNoPrint(getOutput(), "output");
assertNoPrint(getError(), "error output");
assertOutput();
|
public void | testNoCrash()
expectPropertyUnset("nocrash", "crashed");
|
public void | testNoTimeout()
expectPropertyUnset("notimeout", "timeout");
|
public void | testNonForkedCapture()
executeTarget("capture");
assertNoPrint(getLog(), "log");
assertNoPrint(getFullLog(), "debug log");
|
public void | testTimeout()
expectPropertySet("timeout", "timeout");
|