From 6fcd5887aa009a147bc027fb6ba7bdb3a1fea1ab Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Fri, 9 Nov 2001 13:45:04 +0000 Subject: [PATCH] targets are not tasks git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269891 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/BuildFileTest.java | 49 ++++++++++++------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/src/testcases/org/apache/tools/ant/BuildFileTest.java b/src/testcases/org/apache/tools/ant/BuildFileTest.java index 27cebd4cc..930f9c55e 100644 --- a/src/testcases/org/apache/tools/ant/BuildFileTest.java +++ b/src/testcases/org/apache/tools/ant/BuildFileTest.java @@ -82,41 +82,52 @@ public abstract class BuildFileTest extends TestCase { super(name); } + protected void expectBuildException(String target, String cause) { + expectSpecificBuildException(target, cause, null); + } + + /** + * Assert that the given message has been logged with a priority + * >= INFO when running the given target. + */ + protected void expectLog(String target, String log) { + executeTarget(target); + String realLog = getLog(); + assertEquals(log, realLog); + } + protected String getLog() { return logBuffer.toString(); } - protected String getFullLog() { - return fullLogBuffer.toString(); + /** + * Assert that the given message has been logged with a priority + * >= DEBUG when running the given target. + */ + protected void expectDebuglog(String target, String log) { + executeTarget(target); + String realLog = getFullLog(); + assertEquals(log, realLog); } - - - protected void expectBuildException(String taskname, String cause) { - expectSpecificBuildException(taskname, cause, null); + protected String getFullLog() { + return fullLogBuffer.toString(); } - protected void expectOutput(String taskname, String output) { - executeTarget(taskname); + protected void expectOutput(String target, String output) { + executeTarget(target); String realOutput = getOutput(); assertEquals(output, realOutput); } - protected void expectOutputAndError(String taskname, String output, String error) { - executeTarget(taskname); + protected void expectOutputAndError(String target, String output, String error) { + executeTarget(target); String realOutput = getOutput(); assertEquals(output, realOutput); String realError = getError(); assertEquals(error, realError); } - protected void expectLog(String taskname, String log) { - executeTarget(taskname); - String realLog = getLog(); - assertEquals(log, realLog); - } - - protected String getOutput() { return cleanBuffer(outBuffer); } @@ -185,9 +196,9 @@ public abstract class BuildFileTest extends TestCase { return project.getBaseDir(); } - protected void expectSpecificBuildException(String taskname, String cause, String msg) { + protected void expectSpecificBuildException(String target, String cause, String msg) { try { - executeTarget(taskname); + executeTarget(target); } catch (org.apache.tools.ant.BuildException ex) { if ((null != msg) && (ex.getMessage() != msg)) { fail("Should throw BuildException because '" + cause + "' with message '" + msg + "' (received message '" + ex.getMessage() + "' instead)");