Improve names of startup-related tests
[Sone.git] / src / test / kotlin / net / pterodactylus / sone / web / notification / NotificationHandlerModuleTest.kt
1 /**
2  * Sone - NotificationHandlerModuleTest.kt - Copyright © 2019–2020 David ‘Bombe’ Roden
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 package net.pterodactylus.sone.web.notification
19
20 import com.google.inject.*
21 import com.google.inject.Guice.*
22 import com.google.inject.name.Names.*
23 import net.pterodactylus.sone.core.*
24 import net.pterodactylus.sone.core.event.*
25 import net.pterodactylus.sone.data.*
26 import net.pterodactylus.sone.data.Post.*
27 import net.pterodactylus.sone.data.impl.*
28 import net.pterodactylus.sone.database.*
29 import net.pterodactylus.sone.freenet.wot.*
30 import net.pterodactylus.sone.main.*
31 import net.pterodactylus.sone.notify.*
32 import net.pterodactylus.sone.test.*
33 import net.pterodactylus.sone.text.*
34 import net.pterodactylus.sone.utils.*
35 import net.pterodactylus.util.notify.*
36 import org.hamcrest.MatcherAssert.*
37 import org.hamcrest.Matchers.*
38 import org.mockito.*
39 import org.mockito.Mockito.*
40 import java.util.concurrent.*
41 import java.util.concurrent.TimeUnit.*
42 import java.util.function.*
43 import kotlin.test.*
44
45 /**
46  * Unit test for [NotificationHandlerModule].
47  */
48 class NotificationHandlerModuleTest {
49
50         private val core = mock<Core>()
51         private val webOfTrustConnector = mock<WebOfTrustConnector>()
52         private val ticker = mock<ScheduledExecutorService>()
53         private val notificationManager = NotificationManager()
54         private val loaders = TestLoaders()
55         private val injector: Injector = createInjector(
56                         Core::class.isProvidedBy(core),
57                         NotificationManager::class.isProvidedBy(notificationManager),
58                         Loaders::class.isProvidedBy(loaders),
59                         WebOfTrustConnector::class.isProvidedBy(webOfTrustConnector),
60                         ScheduledExecutorService::class.withNameIsProvidedBy(ticker, "notification"),
61                         SoneTextParser::class.isProvidedByMock(),
62                         PostReplyProvider::class.isProvidedByMock(),
63                         NotificationHandlerModule()
64         )
65
66         @Test
67         fun `notification handler is created as singleton`() {
68                 injector.verifySingletonInstance<NotificationHandler>()
69         }
70
71         @Test
72         fun `mark-post-known-during-first-start handler is created as singleton`() {
73                 injector.verifySingletonInstance<MarkPostKnownDuringFirstStartHandler>()
74         }
75
76         @Test
77         fun `mark-post-known-during-first-start handler is created with correct action`() {
78                 notificationManager.firstStart()
79                 val handler = injector.getInstance<MarkPostKnownDuringFirstStartHandler>()
80                 val post = mock<Post>()
81                 handler.newPostFound(NewPostFoundEvent(post))
82                 verify(core).markPostKnown(post)
83         }
84
85         @Test
86         fun `mark-post-reply-known-during-first-start handler is created as singleton`() {
87                 injector.verifySingletonInstance<MarkPostReplyKnownDuringFirstStartHandler>()
88         }
89
90         @Test
91         fun `mark-post-reply-known-during-first-start handler is created with correct action`() {
92                 notificationManager.firstStart()
93                 val handler = injector.getInstance<MarkPostReplyKnownDuringFirstStartHandler>()
94                 val postReply = mock<PostReply>()
95                 handler.newPostReply(NewPostReplyFoundEvent(postReply))
96                 verify(core).markReplyKnown(postReply)
97         }
98
99         @Test
100         fun `sone-locked-on-startup handler is created as singleton`() {
101                 injector.verifySingletonInstance<SoneLockedOnStartupHandler>()
102         }
103
104         @Test
105         fun `module can create sone-locked-on-startup notification with correct id`() {
106                 val notification = injector.getInstance<ListNotification<Sone>>(named("soneLockedOnStartup"))
107                 assertThat(notification.id, equalTo("sone-locked-on-startup"))
108         }
109
110         @Test
111         fun `sone-locked-on-startup notification is created as singleton`() {
112                 injector.verifySingletonInstance<ListNotification<Sone>>(named("soneLockedOnStartup"))
113         }
114
115         @Test
116         fun `module can create sone-locked-on-startup notification with correct template and key`() {
117                 loaders.templates += "/templates/notify/soneLockedOnStartupNotification.html" to "<% sones>".asTemplate()
118                 val notification = injector.getInstance<ListNotification<Sone>>(named("soneLockedOnStartup"))
119                 val sone1 = IdOnlySone("sone1")
120                 val sone2 = IdOnlySone("sone2")
121                 notification.add(sone1)
122                 notification.add(sone2)
123                 assertThat(notification.render(), equalTo(listOf(sone1, sone2).toString()))
124         }
125
126         @Test
127         fun `sone-locked-on-startup notification is dismissable`() {
128                 assertThat(injector.getInstance<ListNotification<Sone>>(named("soneLockedOnStartup")).isDismissable, equalTo(true))
129         }
130
131         @Test
132         fun `new-sone handler is created as singleton`() {
133                 injector.verifySingletonInstance<NewSoneHandler>()
134         }
135
136         @Test
137         fun `new-sone notification has correct ID`() {
138                 assertThat(injector.getInstance<ListNotification<Sone>>(named("newSone")).id, equalTo("new-sone-notification"))
139         }
140
141         @Test
142         fun `new-sone notification has correct key and template`() {
143                 loaders.templates += "/templates/notify/newSoneNotification.html" to "<% sones>".asTemplate()
144                 val notification = injector.getInstance<ListNotification<Sone>>(named("newSone"))
145                 val sones = listOf(IdOnlySone("sone1"), IdOnlySone("sone2"))
146                 sones.forEach(notification::add)
147                 assertThat(notification.render(), equalTo(sones.toString()))
148         }
149
150         @Test
151         fun `new-sone notification is not dismissable`() {
152                 assertThat(injector.getInstance<ListNotification<Sone>>(named("newSone")).isDismissable, equalTo(false))
153         }
154
155         @Test
156         fun `new-remote-post handler is created as singleton`() {
157                 injector.verifySingletonInstance<NewRemotePostHandler>()
158         }
159
160         @Test
161         fun `new-remote-post notification is created as singleton`() {
162                 injector.verifySingletonInstance<ListNotification<Post>>(named("newRemotePost"))
163         }
164
165         @Test
166         fun `new-remote-post notification has correct ID`() {
167                 assertThat(injector.getInstance<ListNotification<Post>>(named("newRemotePost")).id, equalTo("new-post-notification"))
168         }
169
170         @Test
171         fun `new-remote-post notification is not dismissable`() {
172                 assertThat(injector.getInstance<ListNotification<Post>>(named("newRemotePost")).isDismissable, equalTo(false))
173         }
174
175         @Test
176         fun `new-remote-post notification has correct key and template`() {
177                 loaders.templates += "/templates/notify/newPostNotification.html" to "<% posts>".asTemplate()
178                 val notification = injector.getInstance<ListNotification<Post>>(named("newRemotePost"))
179                 val posts = listOf(EmptyPost("post1"), EmptyPost("post2"))
180                 posts.forEach(notification::add)
181                 assertThat(notification.render(), equalTo(posts.toString()))
182         }
183
184         @Test
185         fun `remote-post handler is created as singleton`() {
186                 injector.verifySingletonInstance<RemotePostReplyHandler>()
187         }
188
189         @Test
190         fun `new-remote-post-reply notification is created as singleton`() {
191                 injector.verifySingletonInstance<ListNotification<PostReply>>(named("newRemotePostReply"))
192         }
193
194         @Test
195         fun `new-remote-post-reply notification has correct ID`() {
196                 assertThat(injector.getInstance<ListNotification<PostReply>>(named("newRemotePostReply")).id, equalTo("new-reply-notification"))
197         }
198
199         @Test
200         fun `new-remote-post-reply notification is not dismissable`() {
201                 assertThat(injector.getInstance<ListNotification<PostReply>>(named("newRemotePostReply")).isDismissable, equalTo(false))
202         }
203
204         @Test
205         fun `new-remote-post-reply notification has correct key and template`() {
206                 loaders.templates += "/templates/notify/newReplyNotification.html" to "<% replies>".asTemplate()
207                 val notification = injector.getInstance<ListNotification<PostReply>>(named("newRemotePostReply"))
208                 val postReplies = listOf(createPostReply(), createPostReply())
209                 postReplies.forEach(notification::add)
210                 assertThat(notification.render(), equalTo(postReplies.toString()))
211         }
212
213         @Test
214         fun `sone-locked notification is created as singleton`() {
215                 injector.verifySingletonInstance<ListNotification<Sone>>(named("soneLocked"))
216         }
217
218         @Test
219         fun `sone-locked notification is dismissable`() {
220                 assertThat(injector.getInstance<ListNotification<Sone>>(named("soneLocked")).isDismissable, equalTo(true))
221         }
222
223         @Test
224         fun `sone-locked notification has correct ID`() {
225                 assertThat(injector.getInstance<ListNotification<Sone>>(named("soneLocked")).id, equalTo("sones-locked-notification"))
226         }
227
228         @Test
229         fun `sone-locked notification has correct key and template`() {
230                 loaders.templates += "/templates/notify/lockedSonesNotification.html" to "<% sones>".asTemplate()
231                 val notification = injector.getInstance<ListNotification<Sone>>(named("soneLocked"))
232                 val sones = listOf(IdOnlySone("sone1"), IdOnlySone("sone2"))
233                 sones.forEach(notification::add)
234                 assertThat(notification.render(), equalTo(sones.toString()))
235         }
236
237         @Test
238         fun `sone-locked handler is created as singleton`() {
239                 injector.verifySingletonInstance<SoneLockedHandler>()
240         }
241
242         @Test
243         fun `local-post notification is not dismissable`() {
244                 assertThat(injector.getInstance<ListNotification<Post>>(named("localPost")).isDismissable, equalTo(false))
245         }
246
247         @Test
248         fun `local-post notification has correct ID`() {
249                 assertThat(injector.getInstance<ListNotification<Post>>(named("localPost")).id, equalTo("local-post-notification"))
250         }
251
252         @Test
253         fun `local-post notification has correct key and template`() {
254                 loaders.templates += "/templates/notify/newPostNotification.html" to "<% posts>".asTemplate()
255                 val notification = injector.getInstance<ListNotification<Post>>(named("localPost"))
256                 val posts = listOf(EmptyPost("post1"), EmptyPost("post2"))
257                 posts.forEach(notification::add)
258                 assertThat(notification.render(), equalTo(posts.toString()))
259         }
260
261         @Test
262         fun `local-post notification is created as singleton`() {
263                 injector.verifySingletonInstance<ListNotification<Post>>(named("localPost"))
264         }
265
266         @Test
267         fun `local-post handler is created as singleton`() {
268                 injector.verifySingletonInstance<LocalPostHandler>()
269         }
270
271         @Test
272         fun `local-reply notification is not dismissable`() {
273                 assertThat(injector.getInstance<ListNotification<PostReply>>(named("localReply")).isDismissable, equalTo(false))
274         }
275
276         @Test
277         fun `local-reply notification has correct ID`() {
278                 assertThat(injector.getInstance<ListNotification<PostReply>>(named("localReply")).id, equalTo("local-reply-notification"))
279         }
280
281         @Test
282         fun `local-reply notification has correct key and template`() {
283                 loaders.templates += "/templates/notify/newReplyNotification.html" to "<% replies>".asTemplate()
284                 val notification = injector.getInstance<ListNotification<PostReply>>(named("localReply"))
285                 val replies = listOf(createPostReply("reply1"), createPostReply("reply2"))
286                 replies.forEach(notification::add)
287                 assertThat(notification.render(), equalTo(replies.toString()))
288         }
289
290         @Test
291         fun `local-reply notification is created as singleton`() {
292                 injector.verifySingletonInstance<ListNotification<PostReply>>(named("localReply"))
293         }
294
295         @Test
296         fun `local-reply handler is created as singleton`() {
297                 injector.verifySingletonInstance<LocalReplyHandler>()
298         }
299
300         @Test
301         fun `new-version notification is created as singleton`() {
302                 injector.verifySingletonInstance<TemplateNotification>(named("newVersion"))
303         }
304
305         @Test
306         fun `new-version notification has correct ID`() {
307                 assertThat(injector.getInstance<TemplateNotification>(named("newVersion")).id, equalTo("new-version-notification"))
308         }
309
310         @Test
311         fun `new-version notification is dismissable`() {
312                 assertThat(injector.getInstance<TemplateNotification>(named("newVersion")).isDismissable, equalTo(true))
313         }
314
315         @Test
316         fun `new-version notification loads correct template`() {
317                 loaders.templates += "/templates/notify/newVersionNotification.html" to "1".asTemplate()
318                 val notification = injector.getInstance<TemplateNotification>(named("newVersion"))
319                 assertThat(notification.render(), equalTo("1"))
320         }
321
322         @Test
323         fun `new-version handler is created as singleton`() {
324                 injector.verifySingletonInstance<NewVersionHandler>()
325         }
326
327         @Test
328         fun `inserting-image notification is created as singleton`() {
329                 injector.verifySingletonInstance<ListNotification<Image>>(named("imageInserting"))
330         }
331
332         @Test
333         fun `inserting-image notification has correct ID`() {
334                 assertThat(injector.getInstance<ListNotification<Image>>(named("imageInserting")).id, equalTo("inserting-images-notification"))
335         }
336
337         @Test
338         fun `inserting-image notification is dismissable`() {
339                 assertThat(injector.getInstance<ListNotification<Image>>(named("imageInserting")).isDismissable, equalTo(true))
340         }
341
342         @Test
343         fun `inserting-image notification loads correct template`() {
344                 loaders.templates += "/templates/notify/inserting-images-notification.html" to "<% images>".asTemplate()
345                 val notification = injector.getInstance<ListNotification<Image>>(named("imageInserting"))
346                 val images = listOf(ImageImpl(), ImageImpl()).onEach(notification::add)
347                 assertThat(notification.render(), equalTo(images.toString()))
348         }
349
350         @Test
351         fun `inserting-image-failed notification is created as singleton`() {
352                 injector.verifySingletonInstance<ListNotification<Image>>(named("imageFailed"))
353         }
354
355         @Test
356         fun `inserting-image-failed notification has correct ID`() {
357                 assertThat(injector.getInstance<ListNotification<Image>>(named("imageFailed")).id, equalTo("image-insert-failed-notification"))
358         }
359
360         @Test
361         fun `inserting-image-failed notification is dismissable`() {
362                 assertThat(injector.getInstance<ListNotification<Image>>(named("imageFailed")).isDismissable, equalTo(true))
363         }
364
365         @Test
366         fun `inserting-image-failed notification loads correct template`() {
367                 loaders.templates += "/templates/notify/image-insert-failed-notification.html" to "<% images>".asTemplate()
368                 val notification = injector.getInstance<ListNotification<Image>>(named("imageFailed"))
369                 val images = listOf(ImageImpl(), ImageImpl()).onEach(notification::add)
370                 assertThat(notification.render(), equalTo(images.toString()))
371         }
372
373         @Test
374         fun `inserted-image notification is created as singleton`() {
375                 injector.verifySingletonInstance<ListNotification<Image>>(named("imageInserted"))
376         }
377
378         @Test
379         fun `inserted-image notification has correct ID`() {
380                 assertThat(injector.getInstance<ListNotification<Image>>(named("imageInserted")).id, equalTo("inserted-images-notification"))
381         }
382
383         @Test
384         fun `inserted-image notification is dismissable`() {
385                 assertThat(injector.getInstance<ListNotification<Image>>(named("imageInserted")).isDismissable, equalTo(true))
386         }
387
388         @Test
389         fun `inserted-image notification loads correct template`() {
390                 loaders.templates += "/templates/notify/inserted-images-notification.html" to "<% images>".asTemplate()
391                 val notification = injector.getInstance<ListNotification<Image>>(named("imageInserted"))
392                 val images = listOf(ImageImpl(), ImageImpl()).onEach(notification::add)
393                 assertThat(notification.render(), equalTo(images.toString()))
394         }
395
396         @Test
397         fun `image insert handler is created as singleton`() {
398                 injector.verifySingletonInstance<ImageInsertHandler>()
399         }
400
401         @Test
402         fun `first-start notification is created as singleton`() {
403                 injector.verifySingletonInstance<TemplateNotification>(named("firstStart"))
404         }
405
406         @Test
407         fun `first-start notification has correct ID`() {
408                 assertThat(injector.getInstance<TemplateNotification>(named("firstStart")).id, equalTo("first-start-notification"))
409         }
410
411         @Test
412         fun `first-start notification is dismissable`() {
413                 assertThat(injector.getInstance<TemplateNotification>(named("firstStart")).isDismissable, equalTo(true))
414         }
415
416         @Test
417         fun `first-start notification loads correct template`() {
418                 loaders.templates += "/templates/notify/firstStartNotification.html" to "1".asTemplate()
419                 val notification = injector.getInstance<TemplateNotification>(named("firstStart"))
420                 assertThat(notification.render(), equalTo("1"))
421         }
422
423         @Test
424         fun `first-start handler is created as singleton`() {
425                 injector.verifySingletonInstance<FirstStartHandler>()
426         }
427
428         @Test
429         fun `config-not-read notification is created as singleton`() {
430                 injector.verifySingletonInstance<TemplateNotification>(named("configNotRead"))
431         }
432
433         @Test
434         fun `config-not-read notification has correct ID `() {
435                 assertThat(injector.getInstance<TemplateNotification>(named("configNotRead")).id, equalTo("config-not-read-notification"))
436         }
437
438         @Test
439         fun `config-not-read notification is dismissable`() {
440                 assertThat(injector.getInstance<TemplateNotification>(named("configNotRead")).isDismissable, equalTo(true))
441         }
442
443         @Test
444         fun `config-not-read notification loads correct template`() {
445                 loaders.templates += "/templates/notify/configNotReadNotification.html" to "1".asTemplate()
446                 val notification = injector.getInstance<TemplateNotification>(named("configNotRead"))
447                 assertThat(notification.render(), equalTo("1"))
448         }
449
450         @Test
451         fun `config-not-read handler is created as singleton`() {
452                 injector.verifySingletonInstance<ConfigNotReadHandler>()
453         }
454
455         @Test
456         fun `startup notification can be created`() {
457                 injector.verifySingletonInstance<TemplateNotification>(named("startup"))
458         }
459
460         @Test
461         fun `startup notification has correct ID`() {
462                 assertThat(injector.getInstance<TemplateNotification>(named("startup")).id, equalTo("startup-notification"))
463         }
464
465         @Test
466         fun `startup notification is dismissable`() {
467                 assertThat(injector.getInstance<TemplateNotification>(named("startup")).isDismissable, equalTo(true))
468         }
469
470         @Test
471         fun `startup notification loads correct template`() {
472                 loaders.templates += "/templates/notify/startupNotification.html" to "1".asTemplate()
473                 val notification = injector.getInstance<TemplateNotification>(named("startup"))
474                 assertThat(notification.render(), equalTo("1"))
475         }
476
477         @Test
478         fun `startup handler is created as singleton`() {
479                 injector.verifySingletonInstance<StartupHandler>()
480         }
481
482         @Test
483         fun `web-of-trust notification is created as singleton`() {
484                 injector.verifySingletonInstance<TemplateNotification>(named("webOfTrust"))
485         }
486
487         @Test
488         fun `web-of-trust notification has correct ID`() {
489                 assertThat(injector.getInstance<TemplateNotification>(named("webOfTrust")).id, equalTo("wot-missing-notification"))
490         }
491
492         @Test
493         fun `web-of-trust notification is dismissable`() {
494                 assertThat(injector.getInstance<TemplateNotification>(named("webOfTrust")).isDismissable, equalTo(true))
495         }
496
497         @Test
498         fun `web-of-trust notification loads correct template`() {
499                 loaders.templates += "/templates/notify/wotMissingNotification.html" to "1".asTemplate()
500                 val notification = injector.getInstance<TemplateNotification>(named("webOfTrust"))
501                 assertThat(notification.render(), equalTo("1"))
502         }
503
504         @Test
505         fun `web-of-trust handler is created as singleton`() {
506                 injector.verifySingletonInstance<TemplateNotification>(named("webOfTrust"))
507         }
508
509         @Test
510         fun `web-of-trust reacher is created as singleton`() {
511                 injector.verifySingletonInstance<Runnable>(named("webOfTrustReacher"))
512         }
513
514         @Test
515         fun `web-of-trust reacher access the wot connector`() {
516                 injector.getInstance<Runnable>(named("webOfTrustReacher")).run()
517                 verify(webOfTrustConnector).ping()
518         }
519
520         @Test
521         fun `web-of-trust reschedule is created as singleton`() {
522                 injector.verifySingletonInstance<Consumer<Runnable>>(named("webOfTrustReschedule"))
523         }
524
525         @Test
526         fun `web-of-trust reschedule schedules at the correct delay`() {
527                 val webOfTrustPinger = injector.getInstance<WebOfTrustPinger>()
528                 injector.getInstance<Consumer<Runnable>>(named("webOfTrustReschedule"))(webOfTrustPinger)
529                 verify(ticker).schedule(ArgumentMatchers.eq(webOfTrustPinger), ArgumentMatchers.eq(15L), ArgumentMatchers.eq(SECONDS))
530         }
531
532         @Test
533         fun `sone mention detector is created as singleton`() {
534                 assertThat(injector.getInstance<SoneMentionDetector>(), notNullValue())
535         }
536
537         @Test
538         fun `sone-mentioned notification is created as singleton`() {
539                 injector.verifySingletonInstance<ListNotification<Post>>(named("soneMentioned"))
540         }
541
542         @Test
543         fun `sone-mentioned notification has correct ID`() {
544                 assertThat(injector.getInstance<ListNotification<Post>>(named("soneMentioned")).id, equalTo("mention-notification"))
545         }
546
547         @Test
548         fun `sone-mentioned notification is not dismissable`() {
549                 assertThat(injector.getInstance<ListNotification<Post>>(named("soneMentioned")).isDismissable, equalTo(false))
550         }
551
552         @Test
553         fun `sone-mentioned notification loads correct template`() {
554                 loaders.templates += "/templates/notify/mentionNotification.html" to "<% posts>".asTemplate()
555                 val notification = injector.getInstance<ListNotification<Post>>(named("soneMentioned"))
556                 val posts = listOf(EmptyPost("1"), EmptyPost("2")).onEach(notification::add)
557                 assertThat(notification.render(), equalTo(posts.toString()))
558         }
559
560         @Test
561         fun `sone-mentioned handler is created as singleton`() {
562                 injector.verifySingletonInstance<SoneMentionedHandler>()
563         }
564
565         @Test
566         fun `sone insert notification supplier is created as singleton`() {
567                 injector.verifySingletonInstance<SoneInsertNotificationSupplier>()
568         }
569
570         @Test
571         fun `sone insert notification template is loaded correctly`() {
572                 loaders.templates += "/templates/notify/soneInsertNotification.html" to "foo".asTemplate()
573                 injector.getInstance<SoneInsertNotificationSupplier>()
574                                 .invoke(createRemoteSone())
575                                 .render()
576                                 .let { assertThat(it, equalTo("foo")) }
577         }
578
579         @Test
580         fun `sone notification supplier returns different notifications for different sones`() {
581                 val supplier = injector.getInstance<SoneInsertNotificationSupplier>()
582                 listOf(createRemoteSone(), createRemoteSone(), createRemoteSone())
583                                 .map(supplier)
584                                 .distinct()
585                                 .let { assertThat(it, hasSize(3)) }
586         }
587
588         @Test
589         fun `sone notification supplier caches notifications for a sone`() {
590                 val supplier = injector.getInstance<SoneInsertNotificationSupplier>()
591                 val sone = createRemoteSone()
592                 listOf(sone, sone, sone)
593                                 .map(supplier)
594                                 .distinct()
595                                 .let { assertThat(it, hasSize(1)) }
596         }
597
598         @Test
599         fun `sone notification supplier sets sone in notification template`() {
600                 val supplier = injector.getInstance<SoneInsertNotificationSupplier>()
601                 val sone = createRemoteSone()
602                 val templateNotification = supplier(sone)
603                 assertThat(templateNotification["insertSone"], sameInstance<Any>(sone))
604         }
605
606         @Test
607         fun `sone insert handler is created as singleton`() {
608                 injector.verifySingletonInstance<SoneInsertHandler>()
609         }
610
611 }