[java-metadata-aggregator] branch master updated: MDA-191 - make test looser to accept Java 9 results

Ian Young ian at iay.org.uk
Fri Feb 2 06:18:00 EST 2018


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

iay pushed a commit to branch master
in repository java-metadata-aggregator.

View the commit online:
http://git.shibboleth.net/view/?p=java-metadata-aggregator.git;a=commit;h=8bf21f4b2fc08ac11b5ede8f6a5343fdb0142bd8

The following commit(s) were added to refs/heads/master by this push:
       new  8bf21f4   MDA-191 - make test looser to accept Java 9 results
8bf21f4 is described below

commit 8bf21f4b2fc08ac11b5ede8f6a5343fdb0142bd8
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Fri Feb 2 11:17:54 2018 +0000

    MDA-191 - make test looser to accept Java 9 results
    
    Allow for more than three sub-second digits (i.e., better than millisecond precision) because of Java 9's behaviour.
---
 .../net/shibboleth/metadata/pipeline/ComponentInfoTest.java  | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/aggregator-pipeline/src/test/java/net/shibboleth/metadata/pipeline/ComponentInfoTest.java b/aggregator-pipeline/src/test/java/net/shibboleth/metadata/pipeline/ComponentInfoTest.java
index 8cb8209..7c08598 100644
--- a/aggregator-pipeline/src/test/java/net/shibboleth/metadata/pipeline/ComponentInfoTest.java
+++ b/aggregator-pipeline/src/test/java/net/shibboleth/metadata/pipeline/ComponentInfoTest.java
@@ -45,11 +45,17 @@ public class ComponentInfoTest {
         Assert.assertEquals(infos.get(2).getComponentId(), "pipe", "2");
 
         // Check that we're getting ISO 8601 Z time out from toString
+        // Java 8 gives a result with three sub-second digits (millisecond precision)
+        // Java 9 gives six digits (microsecond precision)
+        // Accept anything with at least three, which is what we used to get from
+        // Joda-Time DateTime values.
         final String zuluPattern =
-                "\\d\\d\\d\\d-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d\\.\\d\\d\\dZ";
+                "\\d\\d\\d\\d-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d\\.\\d\\d\\d\\d*Z";
         for (final ComponentInfo c : infos) {
-            Assert.assertTrue(c.getStartInstant().toString().matches(zuluPattern), "start");
-            Assert.assertTrue(c.getCompleteInstant().toString().matches(zuluPattern), "complete");
+            final String startString = c.getStartInstant().toString();
+            Assert.assertTrue(startString.matches(zuluPattern), "start: " + startString);
+            final String completeString = c.getCompleteInstant().toString();
+            Assert.assertTrue(completeString.matches(zuluPattern), "complete: " + completeString);
         }
     }
 

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


More information about the commits mailing list