stevel 02/03/19 22:42:03
Modified: src/testcases/org/apache/tools/ant BuildFileTest.java
Log:
some comment cleanup/addition and factored out a test into a standalone
assertion
Revision Changes Path
1.11 +30 -10
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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- BuildFileTest.java 18 Mar 2002 02:44:30 -0000 1.10
+++ BuildFileTest.java 20 Mar 2002 06:42:03 -0000 1.11
@@ -203,7 +203,7 @@
/**
* set up to run the named project
*
- [EMAIL PROTECTED] filename name of project file to run
+ * @param filename name of project file to run
*/
protected void configureProject(String filename) {
logBuffer = new StringBuffer();
@@ -217,8 +217,8 @@
/**
* execute a target we have set up
- [EMAIL PROTECTED] configureProject has been called
- [EMAIL PROTECTED] targetName target to run
+ * @pre configureProject has been called
+ * @param targetName target to run
*/
protected void executeTarget(String targetName) {
PrintStream sysOut = System.out;
@@ -251,7 +251,11 @@
protected Project getProject() {
return project;
}
-
+
+ /**
+ * get the directory of the project
+ * @return the base dir of the project
+ */
protected File getProjectDir() {
return project.getBaseDir();
}
@@ -269,7 +273,9 @@
executeTarget(target);
} catch (org.apache.tools.ant.BuildException ex) {
if ((null != msg) && (!ex.getMessage().equals(msg))) {
- fail("Should throw BuildException because '" + cause + "'
with message '" + msg + "' (actual message '" + ex.getMessage() + "' instead)");
+ fail("Should throw BuildException because '" + cause
+ + "' with message '" + msg
+ + "' (actual message '" + ex.getMessage() + "'
instead)");
}
return;
}
@@ -308,13 +314,22 @@
protected void expectPropertySet(String target, String property, String
value) {
executeTarget(target);
+ assertPropertyEquals(property, value);
+ }
+
+ /**
+ * assert that a property equals a value; comparison is case sensitive.
+ * @param property property name
+ * @param value expected value
+ */
+ protected void assertPropertyEquals(String property, String value) {
String result = project.getProperty(property);
assertEquals("property " + property,value,result);
}
/**
- * call a target, verify property is "true"
+ * call a target, verify named property is "true".
*
* @param target build file target
* @param property property name
@@ -346,13 +361,19 @@
return url;
}
+ /**
+ * an output stream which saves stuff to our buffer.
+ */
private class AntOutputStream extends java.io.OutputStream {
public void write(int b) {
outBuffer.append((char)b);
}
}
-
- private class AntTestListener implements BuildListener {
+
+ /**
+ * our own personal build listener
+ */
+ private class AntTestListener implements BuildListener {
/**
* Fired before any targets are started.
*/
@@ -415,8 +436,7 @@
public void messageLogged(BuildEvent event) {
if (event.getPriority() == Project.MSG_INFO ||
event.getPriority() == Project.MSG_WARN ||
- event.getPriority() == Project.MSG_ERR)
- {
+ event.getPriority() == Project.MSG_ERR) {
logBuffer.append(event.getMessage());
}
fullLogBuffer.append(event.getMessage());
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>