X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fnotification%2FNotificationHandlerTest.kt;h=a0ccb9d3dc5adea885f19f9184e27f4e6e9eea7d;hp=d14503861ba512f85437880cdacfd362a77d9c59;hb=b6a8b559407daefde5ce01967190cccf97e2bb00;hpb=188857148a7b035bfc6033b1fd40d774bd1fac65 diff --git a/src/test/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerTest.kt index d145038..a0ccb9d 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerTest.kt @@ -18,7 +18,6 @@ package net.pterodactylus.sone.web.notification import com.google.common.eventbus.* -import com.google.inject.* import com.google.inject.Guice.* import net.pterodactylus.sone.main.* import net.pterodactylus.sone.test.* @@ -52,13 +51,25 @@ class NotificationHandlerTest { @Test fun `notification handler registers handler for sone-locked event`() { handler.start() - assertThat(eventBus.registeredObjects.any { it.javaClass == SoneLockedOnStartupHandler::class.java }, equalTo(true)) + assertThat(eventBus.registeredObjects, hasItem(matches { it.javaClass == SoneLockedOnStartupHandler::class.java })) } @Test fun `notification handler loads sone-locked notification template`() { handler.start() - assertThat(loaders.requestedTemplatePaths.any { it == "/templates/notify/soneLockedOnStartupNotification.html" }, equalTo(true)) + assertThat(loaders.requestedTemplatePaths, hasItem("/templates/notify/soneLockedOnStartupNotification.html")) + } + + @Test + fun `notification handler registers handler for new sone events`() { + handler.start() + assertThat(eventBus.registeredObjects, hasItem(matches { it.javaClass == NewSoneHandler::class.java })) + } + + @Test + fun `notification handler loads new sone notification template`() { + handler.start() + assertThat(loaders.requestedTemplatePaths, hasItem("/templates/notify/newSoneNotification.html")) } }