package net.pterodactylus.sone.web
+import com.google.common.eventbus.*
import com.google.inject.*
import freenet.support.api.*
import net.pterodactylus.sone.core.*
import net.pterodactylus.sone.main.*
import net.pterodactylus.sone.template.*
import net.pterodactylus.sone.text.*
+import net.pterodactylus.sone.web.notification.*
import net.pterodactylus.util.notify.*
import net.pterodactylus.util.template.*
import javax.inject.*
fun getNotificationManager() =
NotificationManager()
+ @Provides
+ @Singleton
+ fun getNotificationHandler(eventBus: EventBus, loaders: Loaders, notificationManager: NotificationManager) =
+ NotificationHandler(eventBus, loaders, notificationManager)
+
}
import net.pterodactylus.sone.template.*
import net.pterodactylus.sone.test.*
import net.pterodactylus.sone.text.*
+import net.pterodactylus.sone.web.notification.*
import net.pterodactylus.sone.web.page.*
import net.pterodactylus.util.notify.*
import net.pterodactylus.util.template.*
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))
+ }
+
}