From 60b0b8a4b6954a0137b963397e144fd4ed82e3a8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 4 Jan 2020 15:42:14 +0100 Subject: [PATCH] =?utf8?q?=F0=9F=9A=A7=20Start=20Sone=20mention=20detector?= =?utf8?q?=20automatically?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../net/pterodactylus/sone/web/notification/NotificationHandler.kt | 4 +++- .../sone/web/notification/NotificationHandlerModule.kt | 2 ++ .../sone/web/notification/NotificationHandlerModuleTest.kt | 7 +++++++ 3 files changed, 12 insertions(+), 1 deletion(-) 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()) + } + } -- 2.7.4