[commands] Test no-op behavior of scheduling a scheduled command (#4806)

This commit is contained in:
Starlight220
2022-12-13 06:29:47 +02:00
committed by GitHub
parent a865f48e96
commit 61c75deb2a
4 changed files with 32 additions and 5 deletions

View File

@@ -70,4 +70,18 @@ class SchedulerTest extends CommandTestBase {
assertEquals(counter.get(), 2);
}
}
@Test
void scheduleScheduledNoOp() {
try (CommandScheduler scheduler = new CommandScheduler()) {
AtomicInteger counter = new AtomicInteger();
Command command = Commands.startEnd(counter::incrementAndGet, () -> {});
scheduler.schedule(command);
scheduler.schedule(command);
assertEquals(counter.get(), 1);
}
}
}