public abstract class QuartzCronExpressionValidatorTest extends CronExpressionValidatorTest
validator| Constructor and Description |
|---|
QuartzCronExpressionValidatorTest() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertErrorQuartzExempt(String cronExpression,
ErrorCode errorCode,
String message,
String value,
int errorOffset,
String whyQuartzIsWrong)
Allow Quartz validator to fail to detect this error.
|
void |
testNameRangesWrongLength()
Quartz's assumption that names are always 3 chars long without checking means that this causes
more characters to get gobbled up as part of the name than should be.
|
void |
testTruncatedExpression()
Quartz's assumption that names are always 3 chars long without checking means that this causes
a
StringIndexOutOfBoundsException and gets reported as a general failure. |
protected boolean |
verifyErrorOffset(int expected,
CronSyntaxException cse)
Exempts the Quartz validator from reporting error offsets correctly as long as it
reports
-1. |
assertError, assertInvalidFlagL, assertInvalidName, assertInvalidNameDayOfWeek, assertInvalidNameField, assertInvalidNameRange, assertValid, exception, stackTrace, testBadDayOfMonthExpressions, testCronDoesNotGrokThatCharacter, testEmptyString, testHashOption, testInvalidIncrements, testLastFlagSpecifiedForUnsupportedField, testLastFlagWithHyphenW, testMisplacedCommas, testMissingFields, testNameRanges, testNumericValueOutOfRange, testQuestionMarkInBothDayFields, testQuestionMarkInNonDayField, testQuestionMarkWithNonWhitespaceAfterIt, testRealWorldErrorsFromCloud, testSupportForLastMinusNumberForDayOfMonth, testTrailingGarbageIgnoredIfYearsArePresent, testWeekdayFlagSpecifiedForUnsupportedFieldprotected boolean verifyErrorOffset(int expected,
CronSyntaxException cse)
-1.
See QuartzParseExceptionMapper for the sad explanation.
verifyErrorOffset in class CronExpressionValidatorTestexpected - the expected error offsetcse - the actual exceptionprotected void assertErrorQuartzExempt(String cronExpression, ErrorCode errorCode, String message, String value, int errorOffset, String whyQuartzIsWrong)
There are several cases where the Quartz cron expression parser forgives errors in the syntax that it really should not permit.
assertErrorQuartzExempt in class CronExpressionValidatorTestcronExpression - the invalid cron expressionerrorCode - the expected error codemessage - the expected error messagevalue - the expected token valueerrorOffset - the expected error offsetwhyQuartzIsWrong - an explanation as to what Quartz does instead and why it is wrongpublic void testNameRangesWrongLength()
testNameRangesWrongLength in class CronExpressionValidatorTestpublic void testTruncatedExpression()
StringIndexOutOfBoundsException and gets reported as a general failure.
We work backwards to try to tell what went wrong, but the logic for this is not perfect and
we cannot tell what field was being checked at the time. We can't assume it is always the
day-of-week at the end of the expression, because Quartz tokenizes the expression into fields
beforehand, so it could just as easily happen to the day-of-month. All we can do is report
INVALID_NAME to be as friendly/helpful as possible.
That's better than nothing, I guess, but the main test does the correct assertion.
testTruncatedExpression in class CronExpressionValidatorTestCopyright © 2017 Atlassian. All rights reserved.