ListNotification<Sone>("sones-locked-notification", "sones", loaders.loadTemplate("/templates/notify/lockedSonesNotification.html"), dismissable = true)
@Provides
- fun getScheduledExecutorService(): ScheduledExecutorService =
- newScheduledThreadPool(1)
-
- @Provides
@Singleton
@Named("localPost")
fun getLocalPostNotification(loaders: Loaders) =
class SoneLockedHandler @Inject constructor(
private val notificationManager: NotificationManager,
@Named("soneLocked") private val notification: ListNotification<Sone>,
- private val executor: ScheduledExecutorService) {
+ @Named("notification") private val executor: ScheduledExecutorService) {
private val future: AtomicReference<ScheduledFuture<*>> = AtomicReference()
class StartupHandler @Inject constructor(
private val notificationManager: NotificationManager,
@Named("startup") private val notification: TemplateNotification,
- private val ticker: ScheduledExecutorService) {
+ @Named("notification") private val ticker: ScheduledExecutorService) {
@Subscribe
fun startup(startup: Startup) {
import org.hamcrest.Matchers.*
import org.mockito.Mockito.*
import java.io.*
+import java.util.concurrent.*
import kotlin.test.*
/**
class NotificationHandlerModuleTest {
private val core = mock<Core>()
+ private val ticker = mock<ScheduledExecutorService>()
private val notificationManager = NotificationManager()
private val loaders = TestLoaders()
private val injector: Injector = createInjector(
Core::class.isProvidedBy(core),
NotificationManager::class.isProvidedBy(notificationManager),
Loaders::class.isProvidedBy(loaders),
+ ScheduledExecutorService::class.withNameIsProvidedBy(ticker, "notification"),
NotificationHandlerModule()
)