X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Ffcp%2FCreatePostCommandTest.kt;h=5fc84f07463ac2ee194ad925749c3a99857c4463;hp=6d2cc81975a5fe82c63df4c89458f5e30389006e;hb=c088dd5a2896d777cc30c5676583782bfa923729;hpb=7522c3e795b53134beadd21c2e72fe48500bde6a diff --git a/src/test/kotlin/net/pterodactylus/sone/fcp/CreatePostCommandTest.kt b/src/test/kotlin/net/pterodactylus/sone/fcp/CreatePostCommandTest.kt index 6d2cc81..5fc84f0 100644 --- a/src/test/kotlin/net/pterodactylus/sone/fcp/CreatePostCommandTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/fcp/CreatePostCommandTest.kt @@ -46,15 +46,15 @@ class CreatePostCommandTest : SoneCommandTest() { @Test fun `request without text results in fcp exception`() { - parameters.putSingle("Sone", "LocalSoneId") + parameters += "Sone" to "LocalSoneId" whenever(core.getSone("LocalSoneId")).thenReturn(Optional.of(localSone)) executeCommandAndExpectFcpException() } @Test fun `request with text creates post`() { - parameters.putSingle("Sone", "LocalSoneId") - parameters.putSingle("Text", "Test") + parameters += "Sone" to "LocalSoneId" + parameters += "Text" to "Test" whenever(core.getSone("LocalSoneId")).thenReturn(of(localSone)) val post = mock().apply { whenever(id).thenReturn("PostId") } whenever(core.createPost(localSone, absent(), "Test")).thenReturn(post) @@ -65,18 +65,18 @@ class CreatePostCommandTest : SoneCommandTest() { @Test fun `request with invalid recipient results in fcp exception`() { - parameters.putSingle("Sone", "LocalSoneId") - parameters.putSingle("Text", "Test") - parameters.putSingle("Recipient", "InvalidSoneId") + parameters += "Sone" to "LocalSoneId" + parameters += "Text" to "Test" + parameters += "Recipient" to "InvalidSoneId" whenever(core.getSone("LocalSoneId")).thenReturn(of(localSone)) executeCommandAndExpectFcpException() } @Test fun `request with recipient the same as the sender returns an error response`() { - parameters.putSingle("Sone", "LocalSoneId") - parameters.putSingle("Text", "Test") - parameters.putSingle("Recipient", "LocalSoneId") + parameters += "Sone" to "LocalSoneId" + parameters += "Text" to "Test" + parameters += "Recipient" to "LocalSoneId" whenever(core.getSone("LocalSoneId")).thenReturn(of(localSone)) val response = command.execute(parameters) assertThat(response.replyParameters["Message"], equalTo("Error")) @@ -85,9 +85,9 @@ class CreatePostCommandTest : SoneCommandTest() { @Test fun `request with text and recipient creates post`() { - parameters.putSingle("Sone", "LocalSoneId") - parameters.putSingle("Text", "Test") - parameters.putSingle("Recipient", "RemoteSoneId") + parameters += "Sone" to "LocalSoneId" + parameters += "Text" to "Test" + parameters += "Recipient" to "RemoteSoneId" whenever(core.getSone("LocalSoneId")).thenReturn(of(localSone)) whenever(core.getSone("RemoteSoneId")).thenReturn(of(remoteSone)) val post = mock().apply { whenever(id).thenReturn("PostId") }