From b8419feef4fb874a033e8bfdfbf4939f3968bd19 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 17 May 2019 10:48:33 +0200 Subject: [PATCH] =?utf8?q?=E2=9E=95=20Make=20Fred=E2=80=99s=20PageMaker=20?= =?utf8?q?available=20to=20Guice?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/net/pterodactylus/sone/main/FreenetModule.kt | 1 + .../kotlin/net/pterodactylus/sone/main/FreenetModuleTest.kt | 11 +++++++++++ 2 files changed, 12 insertions(+) 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() + } + } -- 2.7.4