From: David ‘Bombe’ Roden Date: Sun, 28 Jul 2019 14:08:29 +0000 (+0200) Subject: ✅ Add method to set debug flag X-Git-Tag: v81^2~170 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=fb02c1039ac55c9bcf82507016e3938dc2426a21;p=Sone.git ✅ Add method to set debug flag --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index e0bd804..99527bc 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -235,6 +235,10 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, return debug.get(); } + public void setDebug() { + debug.set(true); + } + /** * Returns the options used by the core. * diff --git a/src/test/kotlin/net/pterodactylus/sone/core/CoreTest.kt b/src/test/kotlin/net/pterodactylus/sone/core/CoreTest.kt index d6c56d4..f595cc0 100644 --- a/src/test/kotlin/net/pterodactylus/sone/core/CoreTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/core/CoreTest.kt @@ -151,4 +151,20 @@ class CoreTest { assertThat(core.debug, equalTo(false)) } + @Test + fun `debug flag can be set`() { + 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) + core.setDebug() + assertThat(core.debug, equalTo(true)) + } + }