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
*/
class LikePostCommandTest : SoneCommandTest() {
- private val post = createPost("PostId", mock<Sone>(), null, 1000, "Text")
+ private val post = createPost("PostId", mock<Sone>(), 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
@Test
fun `request without parameters results in FCP exception`() {
- requestWithoutAnyParameterResultsInFcpException()
+ requestWithoutAnyParameterResultsInFcpException()
}
@Test
@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)
}