✨ Allow specification of annotation for singleton verification
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 3 Dec 2019 17:53:24 +0000 (18:53 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 11 Dec 2019 15:59:00 +0000 (16:59 +0100)
src/test/kotlin/net/pterodactylus/sone/test/Guice.kt

index a4ae1d5..b0bed5c 100644 (file)
@@ -20,9 +20,9 @@ inline fun <reified T : Any> Injector.getInstance(annotation: Annotation? = null
                ?: getInstance(Key.get(object : TypeLiteral<T>() {}))
 
 
-inline fun <reified T : Any> Injector.verifySingletonInstance() {
-       val firstInstance = getInstance<T>()
-       val secondInstance = getInstance<T>()
+inline fun <reified T : Any> Injector.verifySingletonInstance(annotation: Annotation? = null) {
+       val firstInstance = getInstance<T>(annotation)
+       val secondInstance = getInstance<T>(annotation)
        assertThat(firstInstance, sameInstance(secondInstance))
 }