🚧 Start notification handler on plugin start
[Sone.git] / src / test / kotlin / net / pterodactylus / sone / main / SonePluginTest.kt
index 9388cb0..eef312f 100644 (file)
@@ -10,6 +10,7 @@ import net.pterodactylus.sone.fcp.*
 import net.pterodactylus.sone.freenet.wot.*
 import net.pterodactylus.sone.test.*
 import net.pterodactylus.sone.web.*
+import net.pterodactylus.sone.web.notification.*
 import org.hamcrest.MatcherAssert.*
 import org.hamcrest.Matchers.*
 import org.mockito.Mockito.*
@@ -64,6 +65,12 @@ class SonePluginTest {
                assertThat(injector.getInstance<WebOfTrustConnector>(), notNullValue())
        }
 
+       @Test
+       fun `notification handler can be created`() {
+               val injector: Injector = runSonePluginWithRealInjector()
+               assertThat(injector.getInstance<NotificationHandler>(), notNullValue())
+       }
+
        private fun runSonePluginWithRealInjector(): Injector {
                lateinit var injector: Injector
                val sonePlugin = SonePlugin {
@@ -83,6 +90,13 @@ class SonePluginTest {
                verify(core).start()
        }
 
+       @Test
+       fun `notification handler is being started`() {
+               sonePlugin.runPlugin(pluginRespirator)
+               val notificationHandler = injector.getInstance<NotificationHandler>()
+               verify(notificationHandler).start()
+       }
+
 }
 
 private fun mockInjector() = mock<Injector>().apply {