stevel 02/02/09 15:23:23
Modified: src/testcases/org/apache/tools/ant BuildFileTest.java
Log:
Adding javadocs for the main methods that testcases are likely to call
Revision Changes Path
1.8 +67 -0
jakarta-ant/src/testcases/org/apache/tools/ant/BuildFileTest.java
Index: BuildFileTest.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/BuildFileTest.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- BuildFileTest.java 3 Feb 2002 22:21:08 -0000 1.7
+++ BuildFileTest.java 9 Feb 2002 23:23:23 -0000 1.8
@@ -79,10 +79,21 @@
private StringBuffer errBuffer;
private BuildException buildException;
+ /**
+ * Constructor for the BuildFileTest object
+ *
+ [EMAIL PROTECTED] name string to pass up to TestCase constructor
+ */
public BuildFileTest(String name) {
super(name);
}
+ /**
+ * run a target, expect for any build exception
+ *
+ [EMAIL PROTECTED] target target to run
+ [EMAIL PROTECTED] cause information string to reader of report
+ */
protected void expectBuildException(String target, String cause) {
expectSpecificBuildException(target, cause, null);
}
@@ -97,6 +108,13 @@
assertEquals(log, realLog);
}
+ /**
+ * Gets the log the BuildFileTest object.
+ * only valid if configureProject() has
+ * been called.
+ * @pre logBuffer!=null
+ * @return The log value
+ */
protected String getLog() {
return logBuffer.toString();
}
@@ -111,16 +129,38 @@
assertEquals(log, realLog);
}
+ /**
+ * Gets the log the BuildFileTest object.
+ * only valid if configureProject() has
+ * been called.
+ * @pre fullLogBuffer!=null
+ * @return The log value
+ */
protected String getFullLog() {
return fullLogBuffer.toString();
}
+ /**
+ * execute the target, verify output matches expectations
+ *
+ [EMAIL PROTECTED] target target to execute
+ [EMAIL PROTECTED] output output to look for
+ */
+
protected void expectOutput(String target, String output) {
executeTarget(target);
String realOutput = getOutput();
assertEquals(output, realOutput);
}
+ /**
+ * execute the target, verify output matches expectations
+ * and that we got the named error at the end
+ [EMAIL PROTECTED] target target to execute
+ [EMAIL PROTECTED] output output to look for
+ [EMAIL PROTECTED] error Description of Parameter
+ */
+
protected void expectOutputAndError(String target, String output, String
error) {
executeTarget(target);
String realOutput = getOutput();
@@ -160,6 +200,11 @@
return cleanedBuffer.toString();
}
+ /**
+ * set up to run the named project
+ *
+ [EMAIL PROTECTED] filename name of project file to run
+ */
protected void configureProject(String filename) {
logBuffer = new StringBuffer();
fullLogBuffer = new StringBuffer();
@@ -170,6 +215,11 @@
ProjectHelper.configureProject(project, new File(filename));
}
+ /**
+ * execute a target we have set up
+ [EMAIL PROTECTED] configureProject has been called
+ [EMAIL PROTECTED] targetName target to run
+ */
protected void executeTarget(String targetName) {
PrintStream sysOut = System.out;
PrintStream sysErr = System.err;
@@ -197,6 +247,14 @@
return project.getBaseDir();
}
+ /**
+ * run a target, wait for a build exception
+ *
+ [EMAIL PROTECTED] target target to run
+ [EMAIL PROTECTED] cause information string to reader of report
+ [EMAIL PROTECTED] msg the message value of the build exception we
are waiting for
+ set to null for any build exception to be valid
+ */
protected void expectSpecificBuildException(String target, String cause,
String msg) {
try {
executeTarget(target);
@@ -209,6 +267,15 @@
fail("Should throw BuildException because: " + cause);
}
+ /**
+ * run a target, expect an exception string
+ * containing the substring we look for (case sensitive match)
+ *
+ [EMAIL PROTECTED] target target to run
+ [EMAIL PROTECTED] cause information string to reader of report
+ [EMAIL PROTECTED] msg the message value of the build exception we
are waiting for
+ [EMAIL PROTECTED] contains substring of the build exception to look
for
+ */
protected void expectBuildExceptionContaining(String target, String
cause, String contains) {
try {
executeTarget(target);
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>