From 226695fb3e52bf6c58203d9d73ac8436a5414ec2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 11 Jul 2019 14:58:50 +0200 Subject: [PATCH] =?utf8?q?=E2=9C=A8=20Add=20debug=20information=20to=20Cor?= =?utf8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../java/net/pterodactylus/sone/core/Core.java | 7 +++++++ .../kotlin/net/pterodactylus/sone/core/CoreTest.kt | 22 +++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 2ff27c9..a5b219c 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -120,6 +120,8 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, /** The start time. */ private final long startupTime = System.currentTimeMillis(); + private final DebugInformation debugInformation = new DebugInformation(); + /** The preferences. */ private final Preferences preferences; @@ -227,6 +229,11 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, return startupTime; } + @Nonnull + public DebugInformation getDebugInformation() { + return debugInformation; + } + /** * 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 ff997aa..d8d4f0b 100644 --- a/src/test/kotlin/net/pterodactylus/sone/core/CoreTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/core/CoreTest.kt @@ -10,11 +10,12 @@ import net.pterodactylus.sone.freenet.wot.event.* import net.pterodactylus.sone.test.* import net.pterodactylus.util.config.* import org.hamcrest.* -import org.junit.* +import org.hamcrest.MatcherAssert.* +import org.hamcrest.Matchers.* import org.mockito.ArgumentMatchers.eq -import org.mockito.Mockito.inOrder -import org.mockito.Mockito.verify +import org.mockito.Mockito.* import org.mockito.hamcrest.MockitoHamcrest.* +import kotlin.test.* /** * Unit test for [Core] and its subclasses. @@ -135,4 +136,19 @@ class CoreTest { } } + @Test + fun `core starts without debug flags`() { + 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) + assertThat(core.debugInformation.showVersionInformation, equalTo(false)) + } + } -- 2.7.4