@Test
public void reschedule_commands_from_storage() {
final Timestamp schedulingTime = minutesAgo(3);
final Duration delayPrimary = Durations2.fromMinutes(5);
final Duration newDelayExpected = Durations2.fromMinutes(2); // = 5 - 3
final List<Command> commandsPrimary = newArrayList(createProject(),
addTask(),
startProject());
storeAsScheduled(commandsPrimary, delayPrimary, schedulingTime);
commandBus.rescheduleCommands();
final ArgumentCaptor<Command> commandCaptor = ArgumentCaptor.forClass(Command.class);
verify(scheduler, times(commandsPrimary.size())).schedule(commandCaptor.capture());
final List<Command> commandsRescheduled = commandCaptor.getAllValues();
for (Command cmd : commandsRescheduled) {
final long actualDelay = getDelaySeconds(cmd);
Tests.assertSecondsEqual(newDelayExpected.getSeconds(), actualDelay, /*maxDiffSec=*/1);
}
}
CommandSchedulingShould.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:core-java
作者:
评论列表
文章目录