[java-shib-shared] branch main updated: Add some tests against DOM behavior.

Rod Widdowson rdw at steadingsoftware.com
Mon May 1 15:58:27 UTC 2023


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch main
in repository java-shib-shared.

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-shared.git;a=commit;h=957a9b4cda89748f2b732cbdccc14084d477fe9f

The following commit(s) were added to refs/heads/main by this push:
     new 957a9b4c Add some tests against DOM behavior.
957a9b4c is described below

commit 957a9b4cda89748f2b732cbdccc14084d477fe9f
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Mon May 1 16:56:33 2023 +0100

    Add some tests against DOM behavior.
    
    Note the oddity - getAttributeNS() returns the empty string even if
    the attribute is not present.  Under these circumstance
    getAttributeNodeNS does return null.
---
 .../shared/xml/AttributeSupportTest.java           | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/shib-support/src/test/java/net/shibboleth/shared/xml/AttributeSupportTest.java b/shib-support/src/test/java/net/shibboleth/shared/xml/AttributeSupportTest.java
index 6747aad4..ac97b058 100644
--- a/shib-support/src/test/java/net/shibboleth/shared/xml/AttributeSupportTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/AttributeSupportTest.java
@@ -677,8 +677,26 @@ public class AttributeSupportTest {
 
     }
 
+    @Test
+    public void testDomAssumptions() {
+        /*
+         * Test some assumptions we want to make in Spring Parsing
+         */
+        assert attributes.hasAttributeNS(TEST_NS, "testAttrEmpty");
+        assert !attributes.hasAttributeNS(TEST_NS, "testAttrNonExist");
+
+        assert attributes.getAttributeNodeNS(TEST_NS, "testAttrEmpty") != null;
+        assert attributes.getAttributeNodeNS(TEST_NS, "testAttrNonExist") == null;
+
+        assert "".equals(attributes.getAttributeNS(TEST_NS, "testAttrEmpty"));
+        //
+        // This case is weird
+        //
+        final String s= attributes.getAttributeNS(TEST_NS, "testAttrNonExist");
+        assert "".equals(s);
+    }
+
     private <T> T nullValue() {
         return null;
     }
-
-}
\ No newline at end of file
+}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list