From: David ‘Bombe’ Roden Date: Wed, 21 Mar 2018 06:49:20 +0000 (+0100) Subject: Add unit test for SonePlugin X-Git-Tag: v79^2~125 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=83a3f20856988cbe691d675100d4046c2c0259c1;p=Sone.git Add unit test for SonePlugin --- diff --git a/src/test/kotlin/net/pterodactylus/sone/main/SonePluginTest.kt b/src/test/kotlin/net/pterodactylus/sone/main/SonePluginTest.kt new file mode 100644 index 0000000..d0a6f44 --- /dev/null +++ b/src/test/kotlin/net/pterodactylus/sone/main/SonePluginTest.kt @@ -0,0 +1,36 @@ +package net.pterodactylus.sone.main + +import freenet.client.async.USKManager +import freenet.l10n.BaseL10n.LANGUAGE.ENGLISH +import freenet.node.Node +import freenet.node.NodeClientCore +import freenet.pluginmanager.PluginRespirator +import net.pterodactylus.sone.test.TestUtil +import net.pterodactylus.sone.test.deepMock +import net.pterodactylus.sone.test.whenever +import org.junit.Test + +/** + * Unit test for [SonePlugin]. + */ +class SonePluginTest { + + private val sonePlugin = SonePlugin() + private val pluginRespirator = deepMock() + private val node = deepMock() + private val clientCore = deepMock() + private val uskManager = deepMock() + + init { + TestUtil.setFinalField(node, "clientCore", clientCore) + whenever(pluginRespirator.node).thenReturn(node) + TestUtil.setFinalField(clientCore, "uskManager", uskManager); + } + + @Test + fun `sone plugin can be started`() { + sonePlugin.setLanguage(ENGLISH) + sonePlugin.runPlugin(pluginRespirator) + } + +}