🔀 Merge “release/v81” into “master”
[Sone.git] / src / test / kotlin / net / pterodactylus / sone / web / WebInterfaceModuleTest.kt
index 2bb31c9..8840caf 100644 (file)
@@ -3,7 +3,6 @@ package net.pterodactylus.sone.web
 import com.google.inject.Guice.*
 import freenet.client.*
 import freenet.clients.http.*
-import freenet.l10n.*
 import freenet.support.api.*
 import net.pterodactylus.sone.core.*
 import net.pterodactylus.sone.data.*
@@ -21,9 +20,8 @@ import net.pterodactylus.util.template.*
 import net.pterodactylus.util.web.*
 import org.hamcrest.MatcherAssert.*
 import org.hamcrest.Matchers.*
-import org.junit.*
 import java.util.*
-import kotlin.test.Test
+import kotlin.test.*
 
 class WebInterfaceModuleTest {
 
@@ -258,9 +256,7 @@ class WebInterfaceModuleTest {
 
        @Test
        fun `template context factory is created as singleton`() {
-           val factory1 = injector.getInstance<TemplateContextFactory>()
-           val factory2 = injector.getInstance<TemplateContextFactory>()
-               assertThat(factory1, sameInstance(factory2))
+               injector.verifySingletonInstance<TemplateContextFactory>()
        }
 
        @Test
@@ -282,26 +278,12 @@ class WebInterfaceModuleTest {
        @Test
        fun `page toadlet factory is created with correct prefix`() {
                val page = mock<Page<FreenetRequest>>()
-           assertThat(injector.getInstance<PageToadletFactory>().createPageToadlet(page).path(), startsWith("/Sone/"))
+               assertThat(injector.getInstance<PageToadletFactory>().createPageToadlet(page).path(), startsWith("/Sone/"))
        }
 
        @Test
        fun `notification manager is created as singleton`() {
-               val firstNotificationManager = injector.getInstance<NotificationManager>()
-               val secondNotificationManager = injector.getInstance<NotificationManager>()
-               assertThat(firstNotificationManager, sameInstance(secondNotificationManager))
-       }
-
-       @Test
-       fun `notification handler can be created`() {
-               assertThat(injector.getInstance<NotificationHandler>(), notNullValue())
-       }
-
-       @Test
-       fun `notification handler is created as singleton`() {
-               val firstNotificationHandler = injector.getInstance<NotificationHandler>()
-               val secondNotificationHandler = injector.getInstance<NotificationHandler>()
-               assertThat(firstNotificationHandler, sameInstance(secondNotificationHandler))
+               injector.verifySingletonInstance<NotificationManager>()
        }
 
 }