import net.pterodactylus.sone.fcp.*;
import net.pterodactylus.sone.freenet.wot.*;
import net.pterodactylus.sone.web.*;
+import net.pterodactylus.sone.web.notification.NotificationHandler;
import freenet.l10n.BaseL10n.*;
import freenet.l10n.*;
/* create the web interface. */
webInterface = injector.getInstance(WebInterface.class);
+ NotificationHandler notificationHandler = injector.getInstance(NotificationHandler.class);
/* start core! */
core.start();
webInterface.start();
webInterface.setFirstStart(injector.getInstance(Key.get(Boolean.class, Names.named("FirstStart"))));
webInterface.setNewConfig(injector.getInstance(Key.get(Boolean.class, Names.named("NewConfig"))));
+ notificationHandler.start();
}
@VisibleForTesting
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.*
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 {
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 {