diff --git a/docs/assertions.html b/docs/assertions.html
index f7123f0..23bcc26 100644
--- a/docs/assertions.html
+++ b/docs/assertions.html
@@ -89,7 +89,54 @@
<assertEquals message="foo is not bar" expected="bar"
- actual="${foo}" casesensitive="false"/>
+ actual="${foo}" casesensitive="false"/>
+
+
+
+
+ Asserts that its two arguments are not equal.
+
+ Since AntUnit 1.5
+
+
+
+ | Attribute |
+ Description |
+ Required |
+
+
+ | notExpected |
+ First string to test. |
+ Yes |
+
+
+ | actual |
+ Second string to test. |
+ Yes |
+
+
+ | message |
+ Message for the exception if the condition
+ doesn't hold true. Defaults to "Didn't expect
+ 'notExpected' to be 'actual'". |
+ No. |
+
+
+ | casesensitive |
+ Perform a case sensitive comparision.
+ Default is true. |
+ No |
+
+
+
+ Examples
+
+ Make the build fail with the message "foo is bar" if the
+ property foo doesn't hold the value bar regardless of case:
+
+
+ <assertNotEquals message="foo is bar" notExpected="bar"
+ actual="${foo}" casesensitive="false"/>
@@ -125,6 +172,42 @@
<assertPropertySet name="foo"/>
+
+
+ Since AntUnit 1.5
+
+ Asserts that a property hasn't got a value.
+
+
+
+ | Attribute |
+ Description |
+ Required |
+
+
+ | name |
+ Name of the property. |
+ Yes |
+
+
+ | message |
+ Message for the exception if the condition
+ doesn't hold true. Defaults to "Didn't expect property
+ 'name' to be set but was 'actual value'". |
+ No. |
+
+
+
+ Examples
+
+ Make the build fail with the message "Didn't expect property
+ 'foo' but was 'bar'" if the property foo is defined and has
+ value bar:
+
+
+ <assertPropertyNotSet name="foo"/>
+
+
Asserts that a given property is set and holds a certain
@@ -169,7 +252,54 @@
<assertPropertyEquals message="foo is not bar" value="bar"
- name="foo" casesensitive="false"/>
+ name="foo" casesensitive="false"/>
+
+
+
+
+ Since AntUnit 1.5
+
+ Asserts that a given property is set but doesn't hold a certain
+ value.
+
+
+
+ | Attribute |
+ Description |
+ Required |
+
+
+ | name |
+ Name of the property. |
+ Yes |
+
+
+ | value |
+ Not expected value. |
+ Yes |
+
+
+ | message |
+ Message for the exception if the condition
+ doesn't hold true. Defaults to "Didn't expect property 'name' to have value 'value'". |
+ No. |
+
+
+ | casesensitive |
+ Perform a case sensitive comparision.
+ Default is true. |
+ No |
+
+
+
+ Examples
+
+ Make the build fail with the message "foo is bar" if the
+ property foo holds the value bar regardless of case:
+
+
+ <assertPropertyNotEquals message="foo is bar" value="bar"
+ name="foo" casesensitive="false"/>
@@ -219,6 +349,55 @@
name="foo" casesensitive="false"/>
+
+
+ Asserts that a given property is set and doesn't hold a certain
+ value as substring.
+
+ Since AntUnit 1.5
+
+
+
+ | Attribute |
+ Description |
+ Required |
+
+
+ | name |
+ Name of the property. |
+ Yes |
+
+
+ | value |
+ Not expected substring value. |
+ Yes |
+
+
+ | message |
+ Message for the exception if the condition
+ doesn't hold true. Defaults to "Didn't expect property
+ 'name' to contain value 'value' but was
+ 'value of property name'". |
+ No. |
+
+
+ | casesensitive |
+ Perform a case sensitive comparision.
+ Default is true. |
+ No |
+
+
+
+ Examples
+
+ Make the build fail with the message "foo contains bar" if the
+ property foo contains the value bar regardless of case:
+
+
+ <assertPropertyDoesntContain message="foo contains bar" value="bar"
+ name="foo" casesensitive="false"/>
+
+
Asserts that a given file exists.
@@ -607,7 +786,7 @@
No. |
-
+
Example
Make the build fail if the file build.xml and backups/build.xml
@@ -645,7 +824,7 @@
No. |
-
+
Example
Make the build fail if the file build.xml and backups/build.xml
@@ -688,6 +867,41 @@
<assertReferenceSet name="foo"/>
+
+
+ Asserts that a reference hasn't got any value.
+
+ Since AntUnit 1.5
+
+
+
+ | Attribute |
+ Description |
+ Required |
+
+
+ | refid |
+ Id of the reference. |
+ Yes |
+
+
+ | message |
+ Message for the exception if the condition
+ doesn't hold true. Defaults to "Didn't expect reference
+ 'id'". |
+ No. |
+
+
+
+ Examples
+
+ Make the build fail with the message "Didn't expect reference 'foo'"
+ if the reference foo is defined:
+
+
+ <assertReferenceIsNotSet name="foo"/>
+
+
Asserts that a reference has a value of a given type.
diff --git a/src/etc/testcases/assert.xml b/src/etc/testcases/assert.xml
index ca33ada..3677571 100644
--- a/src/etc/testcases/assert.xml
+++ b/src/etc/testcases/assert.xml
@@ -77,6 +77,22 @@ under the License.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -119,6 +135,30 @@ under the License.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -129,6 +169,16 @@ under the License.
+
+
+
+
+
+
+
+
+
+
@@ -214,6 +264,15 @@ under the License.
+
+
+
+
+
+
+
+
+
diff --git a/src/main/org/apache/ant/antunit/antlib.xml b/src/main/org/apache/ant/antunit/antlib.xml
index 115387c..c6e2f76 100644
--- a/src/main/org/apache/ant/antunit/antlib.xml
+++ b/src/main/org/apache/ant/antunit/antlib.xml
@@ -88,6 +88,22 @@ under the License.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ default="Didn't expect property '@{name}' to be set but was '${@{name}}'"/>
@@ -125,6 +141,19 @@ under the License.
+
+
+
+
+
+
+
+
+
+
+
@@ -139,7 +168,24 @@ under the License.
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ default="Expected resource '@{resource}' to contain value '@{value}' but was '${@{resource}}'"/>
-
@@ -204,10 +250,10 @@ under the License.
+ default="Didn't expect resource '@{resource}' to contain value '@{value}' but was '${@{resource}}'"/>
-
@@ -264,11 +310,11 @@ under the License.
+ default="Expected resource '@{refid}' to contain value '@{value}'"/>
-
@@ -279,10 +325,10 @@ under the License.
+ default="Didn't expect resource '@{refid}' to contain value '@{value}'"/>
-
@@ -347,6 +393,19 @@ under the License.
+
+
+
+
+
+
+
+
+
+
+
+
@@ -398,7 +457,7 @@ under the License.
default="Expected '@{string}' to match pattern '@{pattern}'"/>
-
diff --git a/src/tests/junit/org/apache/ant/antunit/AssertTest.java b/src/tests/junit/org/apache/ant/antunit/AssertTest.java
index d56b010..0c7ec78 100644
--- a/src/tests/junit/org/apache/ant/antunit/AssertTest.java
+++ b/src/tests/junit/org/apache/ant/antunit/AssertTest.java
@@ -49,6 +49,12 @@ public class AssertTest extends BuildFileTest {
public void testEqualsCasePass() {
testPass("assertEqualsCasePass");
}
+ public void testNotEqualsPass1() {
+ testPass("assertNotEqualsPass1");
+ }
+ public void testNotEqualsPass2() {
+ testPass("assertNotEqualsPass2");
+ }
public void testPropertySetPass() {
testPass("assertPropertySetPass");
}
@@ -61,6 +67,18 @@ public class AssertTest extends BuildFileTest {
public void testPropertyEqualsCasePass() {
testPass("assertPropertyEqualsCasePass");
}
+ public void testPropertyNotEqualsPass1() {
+ testPass("assertPropertyNotEqualsPass1");
+ }
+ public void testPropertyNotEqualsPass2() {
+ testPass("assertPropertyNotEqualsPass2");
+ }
+ public void testPropertyContains() {
+ testPass("assertPropertyContains");
+ }
+ public void testPropertyDoesntContain() {
+ testPass("assertPropertyDoesntContain");
+ }
public void testFileExistsPass() {
testPass("assertFileExistsPass");
}
@@ -88,6 +106,9 @@ public class AssertTest extends BuildFileTest {
public void testReferenceSetPass() {
testPass("assertReferenceSetPass");
}
+ public void testReferenceIsNotSetPass() {
+ testPass("assertReferenceIsNotSetPass");
+ }
public void testReferenceIsTypePass() {
testPass("assertReferenceIsTypePass");
}
@@ -104,11 +125,17 @@ public class AssertTest extends BuildFileTest {
public void testEqualsFail2() {
testFail("assertEqualsFail2", "Expected 'bar' but was 'BAR'");
}
+ public void testNotEqualsFail() {
+ testFail("assertNotEqualsFail", "Didn't expect 'bar' to be 'bar'");
+ }
+ public void testNotEqualsCaseFail() {
+ testFail("assertNotEqualsCaseFail", "Didn't expect 'bar' to be 'BAR'");
+ }
public void testPropertySetFail() {
testFail("assertPropertySetFail", "Expected property 'foo'");
}
public void testPropertyNotSetFail() {
- testFail("assertPropertyNotSetFail", "Expected property 'foo' to not be set but was 'bar'");
+ testFail("assertPropertyNotSetFail", "Didn't expect property 'foo' to be set but was 'bar'");
}
public void testPropertyEqualsFail1() {
testFail("assertPropertyEqualsFail1", "Expected property 'foo' to have value 'bar' but was '${foo}'");
@@ -119,12 +146,21 @@ public class AssertTest extends BuildFileTest {
public void testPropertyEqualsFail3() {
testFail("assertPropertyEqualsFail3", "Expected property 'foo' to have value 'BAR' but was 'bar'");
}
- public void testPropertyContains() {
- testPass("assertPropertyContains");
+ public void testPropertyNotEqualsFail1() {
+ testFail("assertPropertyNotEqualsFail1", "Didn't expect property 'foo' to have value 'bar'");
+ }
+ public void testPropertyNotEqualsFail2() {
+ testFail("assertPropertyNotEqualsFail2", "Didn't expect property 'foo' to have value 'bar'");
+ }
+ public void testPropertyNotEqualsCaseFail() {
+ testFail("assertPropertyNotEqualsCaseFail", "Didn't expect property 'foo' to have value 'BAR'");
}
public void testPropertyContainsFail() {
testFail("assertPropertyContainsFail", "Expected property 'foo' to contain value 'foo' but was 'bar'");
}
+ public void testPropertyDoesntContainFail() {
+ testFail("assertPropertyDoesntContainFail", "Didn't expect property 'foo' to contain value 'ba' but was 'bar'");
+ }
public void testFileExistsFail() {
testFail("assertFileExistsFail",
"Expected file 'assert.txt' to exist");
@@ -160,6 +196,9 @@ public class AssertTest extends BuildFileTest {
public void testReferenceSetFail() {
testFail("assertReferenceSetFail", "Expected reference 'foo2'");
}
+ public void testReferenceIsNotSetFail() {
+ testFail("assertReferenceIsNotSetFail", "Didn't expect reference 'foo4'");
+ }
public void testReferenceIsTypeFailNotSet() {
testFail("assertReferenceIsTypeFailNotSet",
"Expected reference 'foo4'");