From 72e771b3cfddd7e0c34fd6d6468930f2436443a1 Mon Sep 17 00:00:00 2001 From: depryf Date: Mon, 6 May 2024 15:32:59 -0400 Subject: [PATCH] Added more testing of dates. --- .../com/imsweb/naaccrxml/NaaccrXmlUtilsTest.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/test/java/com/imsweb/naaccrxml/NaaccrXmlUtilsTest.java b/src/test/java/com/imsweb/naaccrxml/NaaccrXmlUtilsTest.java index 7ac68ea..6606ff2 100644 --- a/src/test/java/com/imsweb/naaccrxml/NaaccrXmlUtilsTest.java +++ b/src/test/java/com/imsweb/naaccrxml/NaaccrXmlUtilsTest.java @@ -335,11 +335,17 @@ public void testParseIso8601Date() { assertValidDateValue("-2001-10-26T21:32:52"); assertValidDateValue("2001-10-26T21:32:52.12679"); + assertValidDateValue("2024-05-17T13:45:30-05:00"); + assertValidDateValue("2024-05-17T13:45:30.001-05:00"); + assertValidDateValue("2024-05-17T13:45:30Z"); + assertValidDateValue("2024-05-17T13:45:30.001Z"); + assertInvalidDateValue("2001-10-26"); - assertInvalidDateValue("2001-10-26T21:32"); - assertInvalidDateValue("2001-10-26T25:32:52+02:00"); - assertInvalidDateValue("01-10-26T21:32"); - assertInvalidDateValue("2001-10-26T21:32:52+2:00"); + assertInvalidDateValue("2001-10-26T21:32"); // missing seconds + assertInvalidDateValue("2001-10-26T25:32:52+02:00"); // wrong hour + assertInvalidDateValue("2024-05-17T1:45:30.001Z"); // hours need to be 2 digits + assertInvalidDateValue("01-10-26T21:32"); // wrong year and missing seconds + assertInvalidDateValue("2001-10-26T21:32:52+2:00"); // timezone requires 2 digits } private void assertValidDateValue(String dateValue) {