From: David ‘Bombe’ Roden Date: Fri, 17 May 2019 08:48:33 +0000 (+0200) Subject: ➕ Make Fred’s PageMaker available to Guice X-Git-Tag: v79^2~49 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=b8419feef4fb874a033e8bfdfbf4939f3968bd19;p=Sone.git ➕ Make Fred’s PageMaker available to Guice --- diff --git a/src/main/kotlin/net/pterodactylus/sone/main/FreenetModule.kt b/src/main/kotlin/net/pterodactylus/sone/main/FreenetModule.kt index d8349ba..89d164d 100644 --- a/src/main/kotlin/net/pterodactylus/sone/main/FreenetModule.kt +++ b/src/main/kotlin/net/pterodactylus/sone/main/FreenetModule.kt @@ -20,6 +20,7 @@ class FreenetModule(private val pluginRespirator: PluginRespirator): Module { pluginRespirator.node!!.let { node -> bind(Node::class.java).toProvider(Provider { node }) } bind(HighLevelSimpleClient::class.java).toProvider(Provider { pluginRespirator.hlSimpleClient!! }) bind(ToadletContainer::class.java).toProvider(Provider { pluginRespirator.toadletContainer }) + bind(PageMaker::class.java).toProvider(Provider { pluginRespirator.pageMaker }) } @Provides @Singleton diff --git a/src/test/kotlin/net/pterodactylus/sone/main/FreenetModuleTest.kt b/src/test/kotlin/net/pterodactylus/sone/main/FreenetModuleTest.kt index ed2037d..d51da92 100644 --- a/src/test/kotlin/net/pterodactylus/sone/main/FreenetModuleTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/main/FreenetModuleTest.kt @@ -26,6 +26,7 @@ class FreenetModuleTest { private val node = pluginRespirator.node!! private val highLevelSimpleClient = pluginRespirator.hlSimpleClient!! private val toadletContainer: ToadletContainer = pluginRespirator.toadletContainer + private val pageMaker: PageMaker = pluginRespirator.pageMaker private val module = FreenetModule(pluginRespirator) private val injector = Guice.createInjector(module) @@ -86,4 +87,14 @@ class FreenetModuleTest { verifySingletonInstance() } + @Test + fun `page maker is returned correctly`() { + assertThat(injector.getInstance(), sameInstance(pageMaker)) + } + + @Test + fun `page maker is returned as singleten`() { + verifySingletonInstance() + } + }