✅ Add method to set debug flag
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 28 Jul 2019 14:08:29 +0000 (16:08 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 28 Jul 2019 19:03:45 +0000 (21:03 +0200)
src/main/java/net/pterodactylus/sone/core/Core.java
src/test/kotlin/net/pterodactylus/sone/core/CoreTest.kt

index e0bd804..99527bc 100644 (file)
@@ -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.
         *
index d6c56d4..f595cc0 100644 (file)
@@ -151,4 +151,20 @@ class CoreTest {
                assertThat(core.debug, equalTo(false))
        }
 
+       @Test
+       fun `debug flag can be set`() {
+               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)
+               core.setDebug()
+               assertThat(core.debug, equalTo(true))
+       }
+
 }