From ec074a1c79056bf214a168341586070d7991694a 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:49:07 +0200 Subject: [PATCH] =?utf8?q?=F0=9F=8E=A8=20Fix=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../net/pterodactylus/sone/main/FreenetModule.kt | 15 ++++++------- .../pterodactylus/sone/main/FreenetModuleTest.kt | 25 ++++++++++------------ 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/src/main/kotlin/net/pterodactylus/sone/main/FreenetModule.kt b/src/main/kotlin/net/pterodactylus/sone/main/FreenetModule.kt index 89d164d..9b5fa2e 100644 --- a/src/main/kotlin/net/pterodactylus/sone/main/FreenetModule.kt +++ b/src/main/kotlin/net/pterodactylus/sone/main/FreenetModule.kt @@ -1,19 +1,17 @@ package net.pterodactylus.sone.main -import com.google.inject.Binder -import com.google.inject.Module -import com.google.inject.Provides -import freenet.client.HighLevelSimpleClient +import com.google.inject.* +import freenet.client.* import freenet.clients.http.* -import freenet.node.Node -import freenet.pluginmanager.PluginRespirator +import freenet.node.* +import freenet.pluginmanager.* import javax.inject.Provider import javax.inject.Singleton /** * Guice [Module] that supplies some objects that are in fact supplied by the Freenet node. */ -class FreenetModule(private val pluginRespirator: PluginRespirator): Module { +class FreenetModule(private val pluginRespirator: PluginRespirator) : Module { override fun configure(binder: Binder): Unit = binder.run { bind(PluginRespirator::class.java).toProvider(Provider { pluginRespirator }) @@ -23,7 +21,8 @@ class FreenetModule(private val pluginRespirator: PluginRespirator): Module { bind(PageMaker::class.java).toProvider(Provider { pluginRespirator.pageMaker }) } - @Provides @Singleton + @Provides + @Singleton fun getSessionManager() = pluginRespirator.getSessionManager("Sone")!! } diff --git a/src/test/kotlin/net/pterodactylus/sone/main/FreenetModuleTest.kt b/src/test/kotlin/net/pterodactylus/sone/main/FreenetModuleTest.kt index d51da92..2f55d52 100644 --- a/src/test/kotlin/net/pterodactylus/sone/main/FreenetModuleTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/main/FreenetModuleTest.kt @@ -1,18 +1,15 @@ package net.pterodactylus.sone.main -import com.google.inject.Guice -import freenet.client.HighLevelSimpleClient +import com.google.inject.* +import freenet.client.* import freenet.clients.http.* -import freenet.node.Node -import freenet.pluginmanager.PluginRespirator -import net.pterodactylus.sone.test.deepMock -import net.pterodactylus.sone.test.getInstance -import net.pterodactylus.sone.test.mock -import net.pterodactylus.sone.test.whenever -import org.hamcrest.MatcherAssert.assertThat -import org.hamcrest.Matchers.sameInstance -import org.junit.Test -import org.mockito.Mockito.verify +import freenet.node.* +import freenet.pluginmanager.* +import net.pterodactylus.sone.test.* +import org.hamcrest.MatcherAssert.* +import org.hamcrest.Matchers.* +import org.junit.* +import org.mockito.Mockito.* /** * Unit test for [FreenetModule]. @@ -30,7 +27,7 @@ class FreenetModuleTest { private val module = FreenetModule(pluginRespirator) private val injector = Guice.createInjector(module) - private inline fun verifySingletonInstance() { + private inline fun verifySingletonInstance() { val firstInstance = injector.getInstance() val secondInstance = injector.getInstance() assertThat(firstInstance, sameInstance(secondInstance)) @@ -79,7 +76,7 @@ class FreenetModuleTest { @Test fun `toadlet container is returned correctly`() { - assertThat(injector.getInstance(), sameInstance(toadletContainer)) + assertThat(injector.getInstance(), sameInstance(toadletContainer)) } @Test -- 2.7.4