From: David ‘Bombe’ Roden Date: Thu, 11 Jul 2019 12:58:50 +0000 (+0200) Subject: ✨ Add debug information to Core X-Git-Tag: v81^2~192 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=226695fb3e52bf6c58203d9d73ac8436a5414ec2;p=Sone.git ✨ Add debug information to Core --- 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)) + } + }