Skip to content

Commit ebb34cd

Browse files
authored
Add validation test for DateLiteralComparableFactory to ensure exceptions are thrown for invalid tokens (#283)
1 parent c889a57 commit ebb34cd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

moxygen/main/default/classes/database/soql-engine/interpreter/operator-handler/date-literal-comparable/DateLiteralComparableFactoryTest.cls

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,23 @@ private class DateLiteralComparableFactoryTest {
1919
);
2020
}
2121
}
22+
23+
@isTest
24+
static void ensureValidationWorksAsExpected() {
25+
DateLiteral dl = new DateLiteral.Builder()
26+
.setFieldValue('unexpected_token')
27+
.build();
28+
Boolean isExceptionThrown = false;
29+
try {
30+
DateLiteralComparableFactory.create(dl);
31+
Assert.fail('ValidationException should have been thrown');
32+
} catch (ValidationException e) {
33+
isExceptionThrown = true;
34+
}
35+
36+
Assert.isTrue(
37+
isExceptionThrown,
38+
'ValidationException should have been thrown'
39+
);
40+
}
2241
}

0 commit comments

Comments
 (0)