Fix failing Validator test
@@ -35,19 +35,26 @@ public class ValidatorTests {
@Test
public void timestampTests() {
+ /*
+ length added to each string for reference
+ valid min and max lengths are 19 and 29
+ */
TimestampValidator validator = new TimestampValidator(false);
- Assert.assertTrue(validator.validate("2004-12-01 12:00:00"));
- Assert.assertTrue(validator.validate("2004-12-01T12:00:00"));
- Assert.assertTrue(validator.validate("2004-12-01T12:00:00.124Z"));
- Assert.assertTrue(validator.validate("2009-06-18T18:50:57-06:00"));
- Assert.assertTrue(validator.validate("2009-06-18T18:30:45Z"));
- //Assert.assertTrue(validator.validate("2009-06-18T18:39Z"));
- //Assert.assertTrue(validator.validate("2001-01-12"));
- //Assert.assertTrue(validator.validate("1984-10-16"));
-
- Assert.assertFalse(validator.validate("2004-1-1 12:00:00"));
- Assert.assertFalse(validator.validate("2004-12-0112:00:00"));
- Assert.assertFalse(validator.validate("20041201120000"));
+ Assert.assertTrue(validator.validate("2004-12-01 12:00:00")); //length: 19
+ Assert.assertTrue(validator.validate("2004-12-01T12:00:00")); //length: 19
+ Assert.assertTrue(validator.validate("2004-12-01T12:00:00.124Z")); //length: 24
+ Assert.assertTrue(validator.validate("2009-06-18T18:50:57-06:00")); //length: 25
+ Assert.assertTrue(validator.validate("2009-06-18T18:30:45Z")); //length: 20
+ Assert.assertTrue(validator.validate("2018-06-29T11:09:30.437-07:00")); //length: 29
+
+ Assert.assertFalse(validator.validate("2009-06-18T18:39Z")); //length: 17
+ Assert.assertFalse(validator.validate("2001-01-12")); //length: 10
+ Assert.assertFalse(validator.validate("1984-10-16")); //length: 10
+ Assert.assertFalse(validator.validate("2018-06-29T11:09:30.437-07:00:00")); //length: 32
+
+ Assert.assertFalse(validator.validate("2004-1-1 12:00:00")); //length: 17
+ Assert.assertFalse(validator.validate("2004-12-0112:00:00")); //length: 18
+ Assert.assertFalse(validator.validate("20041201120000")); //length: 14
// Test NULL value
TimestampValidator nullValidator = new TimestampValidator(true);
