From 31de5826e7dd5d063a9c81152326d80ab87105eb Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 15 Jan 2017 13:35:54 +0100 Subject: [PATCH] Add unit test for version command --- .../pterodactylus/sone/fcp/VersionCommandTest.kt | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/test/kotlin/net/pterodactylus/sone/fcp/VersionCommandTest.kt 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")) + } + +} -- 2.7.4