From: David ‘Bombe’ Roden Date: Sun, 28 Jul 2019 14:09:39 +0000 (+0200) Subject: ♻️ Refactor test X-Git-Tag: v81^2~169 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=a57dae72e505fec934a9516b88fea75c473f7641;p=Sone.git ♻️ Refactor test --- diff --git a/src/test/kotlin/net/pterodactylus/sone/core/CoreTest.kt b/src/test/kotlin/net/pterodactylus/sone/core/CoreTest.kt index f595cc0..1b2b363 100644 --- a/src/test/kotlin/net/pterodactylus/sone/core/CoreTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/core/CoreTest.kt @@ -138,21 +138,18 @@ class CoreTest { @Test fun `core starts with debug set to false`() { - val configuration = mock() - val freenetInterface = mock() - val identityManager = mock() - val soneDownloader = mock() - val imageInserter = mock() - val updateChecker = mock() - val webOfTrustUpdater = mock() - val eventBus = mock() - val database = mock() - val core = Core(configuration, freenetInterface, identityManager, soneDownloader, imageInserter, updateChecker, webOfTrustUpdater, eventBus, database) + val core = createCore() assertThat(core.debug, equalTo(false)) } @Test fun `debug flag can be set`() { + val core = createCore() + core.setDebug() + assertThat(core.debug, equalTo(true)) + } + + private fun createCore(): Core { val configuration = mock() val freenetInterface = mock() val identityManager = mock() @@ -162,9 +159,7 @@ class CoreTest { val webOfTrustUpdater = mock() val eventBus = mock() val database = mock() - val core = Core(configuration, freenetInterface, identityManager, soneDownloader, imageInserter, updateChecker, webOfTrustUpdater, eventBus, database) - core.setDebug() - assertThat(core.debug, equalTo(true)) + return Core(configuration, freenetInterface, identityManager, soneDownloader, imageInserter, updateChecker, webOfTrustUpdater, eventBus, database) } }