From: David ‘Bombe’ Roden Date: Thu, 12 Dec 2019 18:55:19 +0000 (+0100) Subject: ✅ Replace test for scheduling with better test X-Git-Tag: v81^2~5^2~34 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=fc2922b836c9f23242135c752653507a573917ea ✅ Replace test for scheduling with better test --- diff --git a/src/test/kotlin/net/pterodactylus/sone/web/notification/StartupHandlerTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/notification/StartupHandlerTest.kt index 38e7f1b..bc2c8e6 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/notification/StartupHandlerTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/notification/StartupHandlerTest.kt @@ -24,6 +24,7 @@ import net.pterodactylus.util.notify.* import net.pterodactylus.util.template.* import org.hamcrest.MatcherAssert.* import org.hamcrest.Matchers.* +import java.util.concurrent.TimeUnit.* import kotlin.test.* /** @@ -50,9 +51,9 @@ class StartupHandlerTest { } @Test - fun `handler registers command on startup`() { + fun `handler registers command on with 2-minute delay`() { eventBus.post(Startup()) - assertThat(executor.scheduleds, hasSize(1)) + assertThat(with(executor.scheduleds.single()) { timeUnit.toNanos(delay) }, equalTo(MINUTES.toNanos(2))) } @Test