|
28 | 28 | import static org.assertj.core.api.Assertions.assertThat;
|
29 | 29 | import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
30 | 30 | import static org.assertj.core.api.Assertions.assertThatNoException;
|
| 31 | +import static org.quartz.SimpleTrigger.MISFIRE_INSTRUCTION_FIRE_NOW; |
| 32 | +import static org.quartz.SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT; |
| 33 | +import static org.quartz.SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT; |
| 34 | +import static org.quartz.SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT; |
| 35 | +import static org.quartz.SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT; |
| 36 | +import static org.quartz.Trigger.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY; |
| 37 | +import static org.quartz.Trigger.MISFIRE_INSTRUCTION_SMART_POLICY; |
31 | 38 |
|
32 | 39 | /**
|
33 | 40 | * Tests for {@link SimpleTriggerFactoryBean}.
|
@@ -69,6 +76,20 @@ void setMisfireInstructionNameToAllSupportedValues() {
|
69 | 76 | .forEach(name -> assertThatNoException().as(name).isThrownBy(() -> factory.setMisfireInstructionName(name)));
|
70 | 77 | }
|
71 | 78 |
|
| 79 | + @Test |
| 80 | + void setMisfireInstruction() { |
| 81 | + assertThatIllegalArgumentException().isThrownBy(() -> factory.setMisfireInstruction(999)); |
| 82 | + |
| 83 | + assertThatNoException().isThrownBy(() -> factory.setMisfireInstruction(MISFIRE_INSTRUCTION_SMART_POLICY)); |
| 84 | + assertThatNoException().isThrownBy(() -> factory.setMisfireInstruction(MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY)); |
| 85 | + assertThatNoException().isThrownBy(() -> factory.setMisfireInstruction(MISFIRE_INSTRUCTION_FIRE_NOW)); |
| 86 | + assertThatNoException().isThrownBy(() -> factory.setMisfireInstruction(MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT)); |
| 87 | + assertThatNoException().isThrownBy(() -> factory.setMisfireInstruction(MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT)); |
| 88 | + assertThatNoException().isThrownBy(() -> factory.setMisfireInstruction(MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT)); |
| 89 | + assertThatNoException().isThrownBy(() -> factory.setMisfireInstruction(MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT)); |
| 90 | + } |
| 91 | + |
| 92 | + |
72 | 93 | private static Stream<Field> streamMisfireInstructionConstants() {
|
73 | 94 | return Arrays.stream(SimpleTrigger.class.getFields())
|
74 | 95 | .filter(ReflectionUtils::isPublicStaticFinal)
|
|
0 commit comments