X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Ffcp%2FGetSoneCommandTest.kt;h=79aad1af4d759f073620e626c5bed3704264cfd0;hp=e73160b4b69346de06446c2a56534d8e2bda1341;hb=8e313509a42a8c638fcac018dd73dd975bf9cb68;hpb=943bbf6848a5975cb994f75f812ef215af62475f diff --git a/src/test/kotlin/net/pterodactylus/sone/fcp/GetSoneCommandTest.kt b/src/test/kotlin/net/pterodactylus/sone/fcp/GetSoneCommandTest.kt index e73160b..79aad1a 100644 --- a/src/test/kotlin/net/pterodactylus/sone/fcp/GetSoneCommandTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/fcp/GetSoneCommandTest.kt @@ -3,7 +3,6 @@ package net.pterodactylus.sone.fcp import net.pterodactylus.sone.core.Core import net.pterodactylus.sone.freenet.fcp.FcpException import net.pterodactylus.sone.test.whenever -import net.pterodactylus.sone.utils.asOptional import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.equalTo import org.hamcrest.Matchers.nullValue @@ -43,8 +42,7 @@ class GetSoneCommandTest : SoneCommandTest() { @Test fun `request with valid Sone parameter results in response with Sone information`() { - whenever(core.getSone("SoneId")).thenReturn(sone.asOptional()) - whenever(core.getSone(null)).thenReturn(null.asOptional()) + whenever(core.getSone("SoneId")).thenReturn(sone) parameters += "Sone" to "SoneId" val replyParameters = command.execute(parameters).replyParameters assertThat(replyParameters["Message"], equalTo("Sone")) @@ -54,8 +52,8 @@ class GetSoneCommandTest : SoneCommandTest() { @Test fun `request with local sone parameter results in followed being true for friend sone`() { - whenever(core.getSone("SoneId")).thenReturn(sone.asOptional()) - whenever(core.getSone("LocalSone")).thenReturn(localSone.asOptional()) + whenever(core.getSone("SoneId")).thenReturn(sone) + whenever(core.getSone("LocalSone")).thenReturn(localSone) whenever(localSone.id).thenReturn("LocalSone") whenever(localSone.hasFriend("SoneId")).thenReturn(true) parameters += "Sone" to "SoneId" @@ -68,8 +66,8 @@ class GetSoneCommandTest : SoneCommandTest() { @Test fun `request with local sone parameter results in followed being false for non-friend sone`() { - whenever(core.getSone("SoneId")).thenReturn(sone.asOptional()) - whenever(core.getSone("LocalSone")).thenReturn(localSone.asOptional()) + whenever(core.getSone("SoneId")).thenReturn(sone) + whenever(core.getSone("LocalSone")).thenReturn(localSone) whenever(localSone.id).thenReturn("LocalSone") parameters += "Sone" to "SoneId" parameters += "LocalSone" to "LocalSone" @@ -81,8 +79,8 @@ class GetSoneCommandTest : SoneCommandTest() { @Test fun `request with remote sone as local sone parameter results in fcp exception`() { - whenever(core.getSone("SoneId")).thenReturn(sone.asOptional()) - whenever(core.getSone("RemoteSone")).thenReturn(remoteSone.asOptional()) + whenever(core.getSone("SoneId")).thenReturn(sone) + whenever(core.getSone("RemoteSone")).thenReturn(remoteSone) whenever(localSone.id).thenReturn("RemoteSone") parameters += "Sone" to "SoneId" parameters += "LocalSone" to "RemoteSone"