From: David ‘Bombe’ Roden Date: Sat, 4 Jan 2020 14:42:14 +0000 (+0100) Subject: 🚧 Start Sone mention detector automatically X-Git-Tag: v81^2~5^2~21 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=60b0b8a4b6954a0137b963397e144fd4ed82e3a8;p=Sone.git 🚧 Start Sone mention detector automatically --- diff --git a/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandler.kt b/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandler.kt index 21a5b37..cc2a2b3 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandler.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandler.kt @@ -18,6 +18,7 @@ package net.pterodactylus.sone.web.notification import net.pterodactylus.sone.freenet.wot.* +import net.pterodactylus.sone.text.* import javax.inject.* /** @@ -37,5 +38,6 @@ class NotificationHandler @Inject constructor( configNotReadHandler: ConfigNotReadHandler, startupHandler: StartupHandler, webOfTrustPinger: WebOfTrustPinger, - webOfTrustHandler: WebOfTrustHandler + webOfTrustHandler: WebOfTrustHandler, + soneMentionDetector: SoneMentionDetector ) diff --git a/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt b/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt index 74c9f43..96a7cdf 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt @@ -24,6 +24,7 @@ import net.pterodactylus.sone.data.* import net.pterodactylus.sone.freenet.wot.* import net.pterodactylus.sone.main.* import net.pterodactylus.sone.notify.* +import net.pterodactylus.sone.text.* import net.pterodactylus.util.notify.* import java.util.concurrent.* import java.util.concurrent.TimeUnit.* @@ -50,6 +51,7 @@ class NotificationHandlerModule : AbstractModule() { bind().asSingleton() bind().asSingleton() bind().asSingleton() + bind().asSingleton() } @Provides diff --git a/src/test/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModuleTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModuleTest.kt index ca52c1f..ea5db56 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModuleTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModuleTest.kt @@ -29,6 +29,7 @@ import net.pterodactylus.sone.freenet.wot.* import net.pterodactylus.sone.main.* import net.pterodactylus.sone.notify.* import net.pterodactylus.sone.test.* +import net.pterodactylus.sone.text.* import net.pterodactylus.sone.utils.* import net.pterodactylus.util.notify.* import org.hamcrest.MatcherAssert.* @@ -58,6 +59,7 @@ class NotificationHandlerModuleTest { Loaders::class.isProvidedBy(loaders), WebOfTrustConnector::class.isProvidedBy(webOfTrustConnector), ScheduledExecutorService::class.withNameIsProvidedBy(ticker, "notification"), + SoneTextParser::class.isProvidedByMock(), NotificationHandlerModule() ) @@ -457,4 +459,9 @@ class NotificationHandlerModuleTest { verify(ticker).schedule(ArgumentMatchers.eq(webOfTrustPinger), ArgumentMatchers.eq(15L), ArgumentMatchers.eq(SECONDS)) } + @Test + fun `sone mention detector is created as singleton`() { + assertThat(injector.getInstance(), notNullValue()) + } + }