[java-support] 02/02: JSPT-75 Do not text inequivalent things

Rod Widdowson rdw at steadingsoftware.com
Sun Oct 8 09:40:20 EDT 2017


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

rdw pushed a commit to branch master
in repository java-support.

View the commit online:
http://git.shibboleth.net/view/?p=java-support.git;a=commit;h=613a80b2dbe0f85d93e943526a78ce98d6b6803d

commit 613a80b2dbe0f85d93e943526a78ce98d6b6803d
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sun Oct 8 14:29:30 2017 +0100

    JSPT-75 Do not text inequivalent things
    
    https://issues.shibboleth.net/jira/browse/JSPT-75
    
    In the pretty print test compare the pretty printed output with other
    pretty printed output.
    
    Leave the only one (straight extrusion of the XML as text against pretty
    print output in place for pre V9 versions.  Test for V9 by the fact that
    its the first version of java to _BNOT_) be major version 1.  Ugly, but
    functional.
---
 .../utilities/java/support/xml/SerializeSupportTest.java          | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/test/java/net/shibboleth/utilities/java/support/xml/SerializeSupportTest.java b/src/test/java/net/shibboleth/utilities/java/support/xml/SerializeSupportTest.java
index a6c0866..de0df3b 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/xml/SerializeSupportTest.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/xml/SerializeSupportTest.java
@@ -185,16 +185,20 @@ public class SerializeSupportTest {
 
     @Test(dependsOnMethods = {"testNodeToString"}) public void testPrettyPrintXML() throws XMLParserException {
         //
-        // Serialize then parse and serialize again
+        // Pretty print then parse and compare.  Pretty print again and compare.
         //
         final String s = SerializeSupport.prettyPrintXML(parent);
 
         final Document dom = parserPool.parse(new StringReader(s));
 
-        Assert.assertEquals(SerializeSupport.nodeToString(dom.getFirstChild()), SerializeSupport.nodeToString(parent),
+        // JSPT-75:  Versions < 9 (i.e. until 1.8) would pass this bogus test.
+        Assert.assertTrue(!System.getProperty("java.version").startsWith("1.") ||
+                SerializeSupport.nodeToString(dom.getFirstChild()).equals(SerializeSupport.nodeToString(parent)),
                 "Should serialize to same output");
 
         assertEquals(dom.getFirstChild(), parent);
+
+        Assert.assertEquals(SerializeSupport.prettyPrintXML(dom.getFirstChild()) , s, "Pretty print should match");
     }
 
     @Test(dependsOnMethods = {"testNodeToString"}) public void testLSOps() throws XMLParserException {

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


More information about the commits mailing list