Skip to content
This repository was archived by the owner on Aug 20, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public boolean test(List<Object> strings) {
}
try {
SimpleDateFormat sdf = new SimpleDateFormat(format.toString());
sdf.setLenient(false);
sdf.parse(date.toString());
return true;
}
Expand Down Expand Up @@ -106,6 +107,7 @@ public boolean isValid( Map<String, Object> input
return false;
}
SimpleDateFormat sdf = new SimpleDateFormat(format);
sdf.setLenient(false);
for(Object o : input.values()) {
if(o == null) {
return true;
Expand All @@ -126,6 +128,7 @@ public void initialize(Map<String, Object> validationConfig, Map<String, Object>
throw new IllegalStateException("You must specify '" + Config.FORMAT.key + "' in the config");
}
SimpleDateFormat sdf = new SimpleDateFormat(format);
sdf.setLenient(false);
try {
sdf.format(new Date());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ public void negativeTest_single() throws IOException {
Assert.assertFalse(execute(validWithSingleField, ImmutableMap.of("field1", "2014/05/01")));
Assert.assertFalse(runPredicate(validWithSingleField_MQL, ImmutableMap.of("field1", "2014/05/01")));
Assert.assertFalse(execute(validWithSingleField, ImmutableMap.of("field1", 2.3f)));
//invalid month
Assert.assertFalse(runPredicate(validWithSingleField_MQL, ImmutableMap.of("field1", "2014-25-01")));
//invalid date
Assert.assertFalse(runPredicate(validWithSingleField_MQL, ImmutableMap.of("field1", "2014-05-32")));
}
@Test
public void positiveTest_multiple() throws IOException {
Expand Down