X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Ffcp%2FCreatePostCommandTest.kt;h=2d77c6e89ef51d1667cfb31e7f541b9ad97a39c5;hp=5fc84f07463ac2ee194ad925749c3a99857c4463;hb=8e313509a42a8c638fcac018dd73dd975bf9cb68;hpb=943bbf6848a5975cb994f75f812ef215af62475f diff --git a/src/test/kotlin/net/pterodactylus/sone/fcp/CreatePostCommandTest.kt b/src/test/kotlin/net/pterodactylus/sone/fcp/CreatePostCommandTest.kt index 5fc84f0..2d77c6e 100644 --- a/src/test/kotlin/net/pterodactylus/sone/fcp/CreatePostCommandTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/fcp/CreatePostCommandTest.kt @@ -1,6 +1,5 @@ package net.pterodactylus.sone.fcp -import com.google.common.base.Optional import com.google.common.base.Optional.absent import com.google.common.base.Optional.of import net.pterodactylus.sone.core.Core @@ -47,7 +46,7 @@ class CreatePostCommandTest : SoneCommandTest() { @Test fun `request without text results in fcp exception`() { parameters += "Sone" to "LocalSoneId" - whenever(core.getSone("LocalSoneId")).thenReturn(Optional.of(localSone)) + whenever(core.getSone("LocalSoneId")).thenReturn(localSone) executeCommandAndExpectFcpException() } @@ -55,7 +54,7 @@ class CreatePostCommandTest : SoneCommandTest() { fun `request with text creates post`() { parameters += "Sone" to "LocalSoneId" parameters += "Text" to "Test" - whenever(core.getSone("LocalSoneId")).thenReturn(of(localSone)) + whenever(core.getSone("LocalSoneId")).thenReturn(localSone) val post = mock().apply { whenever(id).thenReturn("PostId") } whenever(core.createPost(localSone, absent(), "Test")).thenReturn(post) val response = command.execute(parameters) @@ -68,7 +67,7 @@ class CreatePostCommandTest : SoneCommandTest() { parameters += "Sone" to "LocalSoneId" parameters += "Text" to "Test" parameters += "Recipient" to "InvalidSoneId" - whenever(core.getSone("LocalSoneId")).thenReturn(of(localSone)) + whenever(core.getSone("LocalSoneId")).thenReturn(localSone) executeCommandAndExpectFcpException() } @@ -77,7 +76,7 @@ class CreatePostCommandTest : SoneCommandTest() { parameters += "Sone" to "LocalSoneId" parameters += "Text" to "Test" parameters += "Recipient" to "LocalSoneId" - whenever(core.getSone("LocalSoneId")).thenReturn(of(localSone)) + whenever(core.getSone("LocalSoneId")).thenReturn(localSone) val response = command.execute(parameters) assertThat(response.replyParameters["Message"], equalTo("Error")) assertThat(response.replyParameters["ErrorMessage"], notNullValue()) @@ -88,8 +87,8 @@ class CreatePostCommandTest : SoneCommandTest() { 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)) + whenever(core.getSone("LocalSoneId")).thenReturn(localSone) + whenever(core.getSone("RemoteSoneId")).thenReturn(remoteSone) val post = mock().apply { whenever(id).thenReturn("PostId") } whenever(core.createPost(localSone, of(remoteSone), "Test")).thenReturn(post) val response = command.execute(parameters)