X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Ffcp%2FGetPostFeedCommandTest.kt;h=72daa07ce5584c9bf251ff6d18259752d9e3e632;hb=ffd92ca2374c0b2218e583d02e0bdd24b8c110ae;hp=c2f0a7ab836cd3f9bd9bc63026132f6725c98e74;hpb=e79b0829db2fbfd9f50ad4526c638055b6304429;p=Sone.git diff --git a/src/test/kotlin/net/pterodactylus/sone/fcp/GetPostFeedCommandTest.kt b/src/test/kotlin/net/pterodactylus/sone/fcp/GetPostFeedCommandTest.kt index c2f0a7a..72daa07 100644 --- a/src/test/kotlin/net/pterodactylus/sone/fcp/GetPostFeedCommandTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/fcp/GetPostFeedCommandTest.kt @@ -2,8 +2,8 @@ package net.pterodactylus.sone.fcp import freenet.support.SimpleFieldSet import net.pterodactylus.sone.core.Core -import net.pterodactylus.sone.test.asOptional import net.pterodactylus.sone.test.whenever +import net.pterodactylus.sone.utils.asOptional import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.containsInAnyOrder import org.hamcrest.Matchers.equalTo @@ -56,7 +56,7 @@ class GetPostFeedCommandTest : SoneCommandTest() { } private fun setupAllPostsAndReplies() { - parameters.putSingle("Sone", "ValidSoneId") + parameters += "Sone" to "ValidSoneId" whenever(localSone.id).thenReturn("ValidSoneId") whenever(core.getSone("ValidSoneId")).thenReturn(localSone.asOptional()) whenever(core.getSone("Friend1")).thenReturn(friend1.asOptional()) @@ -133,7 +133,7 @@ class GetPostFeedCommandTest : SoneCommandTest() { @Test fun `request with larger start than number of posts returns empty feed`() { setupAllPostsAndReplies() - parameters.putSingle("StartPost", "20") + parameters += "StartPost" to "20" val replyParameters = command.execute(parameters).replyParameters assertThat(replyParameters["Message"], equalTo("PostFeed")) assertThat(replyParameters["Posts.Count"], equalTo("0")) @@ -142,7 +142,7 @@ class GetPostFeedCommandTest : SoneCommandTest() { @Test fun `request with max posts of 2 returns the first two posts`() { setupAllPostsAndReplies() - parameters.putSingle("MaxPosts", "2") + parameters += "MaxPosts" to "2" val replyParameters = command.execute(parameters).replyParameters assertThat(replyParameters["Message"], equalTo("PostFeed")) assertThat(replyParameters["Posts.Count"], equalTo("2")) @@ -154,8 +154,8 @@ class GetPostFeedCommandTest : SoneCommandTest() { @Test fun `request with max posts of 2 and start post of 1 returns the center two posts`() { setupAllPostsAndReplies() - parameters.putSingle("StartPost", "1") - parameters.putSingle("MaxPosts", "2") + parameters += "StartPost" to "1" + parameters += "MaxPosts" to "2" val replyParameters = command.execute(parameters).replyParameters assertThat(replyParameters["Message"], equalTo("PostFeed")) assertThat(replyParameters["Posts.Count"], equalTo("2")) @@ -167,8 +167,8 @@ class GetPostFeedCommandTest : SoneCommandTest() { @Test fun `request with max posts of 2 and start post of 3 returns the last post`() { setupAllPostsAndReplies() - parameters.putSingle("StartPost", "3") - parameters.putSingle("MaxPosts", "2") + parameters += "StartPost" to "3" + parameters += "MaxPosts" to "2" val replyParameters = command.execute(parameters).replyParameters assertThat(replyParameters["Message"], equalTo("PostFeed")) assertThat(replyParameters["Posts.Count"], equalTo("1"))