✨ Add debug information to Core
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 11 Jul 2019 12:58:50 +0000 (14:58 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 11 Jul 2019 12:58:50 +0000 (14:58 +0200)
src/main/java/net/pterodactylus/sone/core/Core.java
src/test/kotlin/net/pterodactylus/sone/core/CoreTest.kt

index 2ff27c9..a5b219c 100644 (file)
@@ -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.
         *
index ff997aa..d8d4f0b 100644 (file)
@@ -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<Configuration>()
+               val freenetInterface = mock<FreenetInterface>()
+               val identityManager = mock<IdentityManager>()
+               val soneDownloader = mock<SoneDownloader>()
+               val imageInserter = mock<ImageInserter>()
+               val updateChecker = mock<UpdateChecker>()
+               val webOfTrustUpdater = mock<WebOfTrustUpdater>()
+               val eventBus = mock<EventBus>()
+               val database = mock<Database>()
+               val core = Core(configuration, freenetInterface, identityManager, soneDownloader, imageInserter, updateChecker, webOfTrustUpdater, eventBus, database)
+               assertThat(core.debugInformation.showVersionInformation, equalTo(false))
+       }
+
 }