From: David ‘Bombe’ Roden Date: Sun, 15 Jan 2017 12:35:54 +0000 (+0100) Subject: Add unit test for version command X-Git-Tag: 0.9.7^2~331 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=31de5826e7dd5d063a9c81152326d80ab87105eb;p=Sone.git Add unit test for version command --- diff --git a/src/test/kotlin/net/pterodactylus/sone/fcp/VersionCommandTest.kt b/src/test/kotlin/net/pterodactylus/sone/fcp/VersionCommandTest.kt new file mode 100644 index 0000000..e54e7aa --- /dev/null +++ b/src/test/kotlin/net/pterodactylus/sone/fcp/VersionCommandTest.kt @@ -0,0 +1,29 @@ +package net.pterodactylus.sone.fcp + +import net.pterodactylus.sone.core.Core +import net.pterodactylus.sone.main.SonePlugin +import org.hamcrest.MatcherAssert.assertThat +import org.hamcrest.Matchers.equalTo +import org.junit.Test + +/** + * Unit test for [VersionCommand]. + */ +class VersionCommandTest : SoneCommandTest() { + + override fun createCommand(core: Core) = VersionCommand(core) + + @Test + fun `command does not require write access`() { + assertThat(command.requiresWriteAccess(), equalTo(false)) + } + + @Test + fun `command replies with the correct version information`() { + val replyParameters = command.execute(parameters).replyParameters + assertThat(replyParameters["Message"], equalTo("Version")) + assertThat(replyParameters["Version"], equalTo(SonePlugin.getPluginVersion().toString())) + assertThat(replyParameters["ProtocolVersion"], equalTo("1")) + } + +}