X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Ffcp%2FLikePostCommandTest.kt;h=20358c69fe83aa4aff541890006fcaa7c7038444;hp=792c1b707f4be9fcd32a19d7e9221fcd914d1ab2;hb=03c29a3838e23ed0b9731ca4d84cf58038c30dfe;hpb=ae078c3b54fce575270aae9ec645a286641aea71 diff --git a/src/test/kotlin/net/pterodactylus/sone/fcp/LikePostCommandTest.kt b/src/test/kotlin/net/pterodactylus/sone/fcp/LikePostCommandTest.kt index 792c1b7..20358c6 100644 --- a/src/test/kotlin/net/pterodactylus/sone/fcp/LikePostCommandTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/fcp/LikePostCommandTest.kt @@ -3,9 +3,9 @@ package net.pterodactylus.sone.fcp import net.pterodactylus.sone.core.Core import net.pterodactylus.sone.data.Sone import net.pterodactylus.sone.freenet.fcp.FcpException -import net.pterodactylus.sone.test.asOptional import net.pterodactylus.sone.test.mock import net.pterodactylus.sone.test.whenever +import net.pterodactylus.sone.utils.asOptional import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.equalTo import org.junit.Before @@ -17,25 +17,25 @@ import org.mockito.Mockito.verify */ class LikePostCommandTest : SoneCommandTest() { - private val post = createPost("PostId", mock(), null, 1000, "Text") + private val post = createPost("PostId", mock(), null, 1000, "Text") override fun createCommand(core: Core) = LikePostCommand(core) @Before fun setupPostAndSones() { - whenever(core.getPost("PostId")).thenReturn(post.asOptional()) - whenever(core.getSone("RemoteSoneId")).thenReturn(remoteSone.asOptional()) - whenever(core.getSone("LocalSoneId")).thenReturn(localSone.asOptional()) + whenever(core.getPost("PostId")).thenReturn(post) + whenever(core.getSone("RemoteSoneId")).thenReturn(remoteSone) + whenever(core.getSone("LocalSoneId")).thenReturn(localSone) } @Test fun `command requires write access`() { - assertThat(command.requiresWriteAccess(), equalTo(true)) + assertThat(command.requiresWriteAccess, equalTo(true)) } @Test fun `request without parameters results in FCP exception`() { - requestWithoutAnyParameterResultsInFcpException() + requestWithoutAnyParameterResultsInFcpException() } @Test @@ -47,7 +47,7 @@ class LikePostCommandTest : SoneCommandTest() { @Test fun `request with missing local sone results in FCP exception`() { - parameters += "Post" to "PostId" + parameters += "Post" to "PostId" expectedException.expect(FcpException::class.java) command.execute(parameters) } @@ -70,7 +70,7 @@ class LikePostCommandTest : SoneCommandTest() { @Test fun `request with valid parameters adds post to liked posts for sone`() { - whenever(core.getLikes(post)).thenReturn(setOf(mock(), mock(), mock())) + whenever(core.getLikes(post)).thenReturn(setOf(mock(), mock(), mock())) parameters += "Post" to "PostId" parameters += "Sone" to "LocalSoneId" val replyParameters = command.execute(parameters).replyParameters