You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by di...@apache.org on 2005/11/14 02:05:19 UTC
svn commit: r344018 - in
/jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src:
java/org/apache/commons/jelly/tags/junit/
test/org/apache/commons/jelly/tags/junit/
Author: dion
Date: Sun Nov 13 17:04:40 2005
New Revision: 344018
URL: http://svn.apache.org/viewcvs?rev=344018&view=rev
Log:
Add tests and complete implementation for AssertFileExists
Modified:
jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileExistsTag.java
jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/JUnitTagLibrary.java
jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/test/org/apache/commons/jelly/tags/junit/suite.jelly
Modified: jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileExistsTag.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileExistsTag.java?rev=344018&r1=344017&r2=344018&view=diff
==============================================================================
--- jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileExistsTag.java (original)
+++ jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/AssertFileExistsTag.java Sun Nov 13 17:04:40 2005
@@ -20,6 +20,7 @@
import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.jelly.expression.Expression;
+import org.apache.commons.jelly.tags.junit.FailTag;
/**
* Checks that a file exists, and if not, then the test will fail.
@@ -45,8 +46,19 @@
{
fail(message, "file given is null");
}
+ else
+ {
+ if (!file.exists())
+ {
+ fail(message);
+ }
+ }
}
+ /**
+ * The file to be tested. If this file exists, the test will pass.
+ * @param aFile the file to test.
+ */
public void setFile(File aFile)
{
file = aFile;
Modified: jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/JUnitTagLibrary.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/JUnitTagLibrary.java?rev=344018&r1=344017&r2=344018&view=diff
==============================================================================
--- jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/JUnitTagLibrary.java (original)
+++ jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/java/org/apache/commons/jelly/tags/junit/JUnitTagLibrary.java Sun Nov 13 17:04:40 2005
@@ -42,6 +42,7 @@
public JUnitTagLibrary() {
registerTag("assert", AssertTag.class);
registerTag("assertEquals", AssertEqualsTag.class);
+ registerTag("assertFileExists", AssertFileExistsTag.class);
registerTag("assertThrows", AssertThrowsTag.class);
registerTag("fail", FailTag.class);
registerTag("run", RunTag.class );
Modified: jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/test/org/apache/commons/jelly/tags/junit/suite.jelly
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/test/org/apache/commons/jelly/tags/junit/suite.jelly?rev=344018&r1=344017&r2=344018&view=diff
==============================================================================
--- jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/test/org/apache/commons/jelly/tags/junit/suite.jelly (original)
+++ jakarta/commons/proper/jelly/trunk/jelly-tags/junit/src/test/org/apache/commons/jelly/tags/junit/suite.jelly Sun Nov 13 17:04:40 2005
@@ -128,4 +128,13 @@
</test:case>
-->
+ <test:case>
+ <test:assertFileExists file="${basedir}/project.xml"/>
+
+ <test:assertThrows var="ex">
+ <test:assertFileExists file="${basedir}/dummydummy"/>
+ </test:assertThrows>
+ <test:assert test="${ex != null}">No exception thrown for bad file</test:assert>
+ </test:case>
+
</test:suite>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org