From d00b9e083327fb4ff1fbdf224f2ee994643f6be3 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 14 May 2026 21:35:02 +0200 Subject: [PATCH] add a assertPropertyNotSet assertion --- changes.xml | 3 +++ src/etc/testcases/assert.xml | 9 +++++++++ src/main/org/apache/ant/antunit/antlib.xml | 13 +++++++++++++ .../junit/org/apache/ant/antunit/AssertTest.java | 6 ++++++ 4 files changed, 31 insertions(+) diff --git a/changes.xml b/changes.xml index a100c2b..ad29a93 100644 --- a/changes.xml +++ b/changes.xml @@ -45,6 +45,9 @@ Only works properly with Ant 1.10.13 or later. + + Add a new assertPropertyNotSet assertion. + diff --git a/src/etc/testcases/assert.xml b/src/etc/testcases/assert.xml index 8859b3d..ca33ada 100644 --- a/src/etc/testcases/assert.xml +++ b/src/etc/testcases/assert.xml @@ -86,6 +86,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 87327bf..115387c 100644 --- a/src/main/org/apache/ant/antunit/antlib.xml +++ b/src/main/org/apache/ant/antunit/antlib.xml @@ -99,6 +99,19 @@ under the License. + + + + + + + + + + + + diff --git a/src/tests/junit/org/apache/ant/antunit/AssertTest.java b/src/tests/junit/org/apache/ant/antunit/AssertTest.java index 9e2ac1b..d56b010 100644 --- a/src/tests/junit/org/apache/ant/antunit/AssertTest.java +++ b/src/tests/junit/org/apache/ant/antunit/AssertTest.java @@ -52,6 +52,9 @@ public class AssertTest extends BuildFileTest { public void testPropertySetPass() { testPass("assertPropertySetPass"); } + public void testPropertyNotSetPass() { + testPass("assertPropertyNotSetPass"); + } public void testPropertyEqualsPass() { testPass("assertPropertyEqualsPass"); } @@ -104,6 +107,9 @@ public class AssertTest extends BuildFileTest { public void testPropertySetFail() { testFail("assertPropertySetFail", "Expected property 'foo'"); } + public void testPropertyNotSetFail() { + testFail("assertPropertyNotSetFail", "Expected property 'foo' to not be set but was 'bar'"); + } public void testPropertyEqualsFail1() { testFail("assertPropertyEqualsFail1", "Expected property 'foo' to have value 'bar' but was '${foo}'"); }