♻️ Use new method to set field in tests
[Sone.git] / src / test / kotlin / net / pterodactylus / sone / main / SonePluginTest.kt
1 package net.pterodactylus.sone.main
2
3 import freenet.client.async.USKManager
4 import freenet.l10n.BaseL10n.LANGUAGE.ENGLISH
5 import freenet.node.Node
6 import freenet.node.NodeClientCore
7 import freenet.pluginmanager.PluginRespirator
8 import net.pterodactylus.sone.test.*
9 import org.junit.Test
10
11 /**
12  * Unit test for [SonePlugin].
13  */
14 class SonePluginTest {
15
16         private val sonePlugin = SonePlugin()
17         private val pluginRespirator = deepMock<PluginRespirator>()
18         private val node = deepMock<Node>()
19         private val clientCore = deepMock<NodeClientCore>()
20         private val uskManager = deepMock<USKManager>()
21
22         init {
23                 setField(node, "clientCore", clientCore)
24                 whenever(pluginRespirator.node).thenReturn(node)
25                 setField(clientCore, "uskManager", uskManager)
26         }
27
28         @Test
29         fun `sone plugin can be started`() {
30                 sonePlugin.setLanguage(ENGLISH)
31                 sonePlugin.runPlugin(pluginRespirator)
32         }
33
34 }