Remove unnecessary type parameters
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 22 Feb 2019 23:11:19 +0000 (00:11 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 22 Feb 2019 23:11:19 +0000 (00:11 +0100)
26 files changed:
src/main/kotlin/net/pterodactylus/sone/template/LinkedElementsFilter.kt
src/main/kotlin/net/pterodactylus/sone/utils/Objects.kt
src/main/kotlin/net/pterodactylus/sone/utils/Pagination.kt
src/test/kotlin/net/pterodactylus/sone/fcp/LikePostCommandTest.kt
src/test/kotlin/net/pterodactylus/sone/fcp/LikeReplyCommandTest.kt
src/test/kotlin/net/pterodactylus/sone/main/FreenetModuleTest.kt
src/test/kotlin/net/pterodactylus/sone/template/ImageAccessorTest.kt
src/test/kotlin/net/pterodactylus/sone/template/LinkedElementRenderFilterTest.kt
src/test/kotlin/net/pterodactylus/sone/template/ProfileAccessorTest.kt
src/test/kotlin/net/pterodactylus/sone/template/ReplyAccessorTest.kt
src/test/kotlin/net/pterodactylus/sone/template/SoneAccessorTest.kt
src/test/kotlin/net/pterodactylus/sone/test/Guice.kt
src/test/kotlin/net/pterodactylus/sone/test/Mockotlin.kt
src/test/kotlin/net/pterodactylus/sone/test/OneByOneMatcher.kt
src/test/kotlin/net/pterodactylus/sone/text/SonePartTest.kt
src/test/kotlin/net/pterodactylus/sone/utils/PaginationTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/NewPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/SearchPageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/UploadImagePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/ViewSonePageTest.kt
src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt

index c9414ea..0ed8df2 100644 (file)
@@ -27,9 +27,9 @@ class LinkedElementsFilter(private val elementLoader: ElementLoader) : Filter {
                                                ?.filterIsInstance<FreenetLinkPart>()
                                                ?.map { elementLoader.loadElement(it.link) }
                                                ?.filter { !it.failed }
-                                               ?: listOf<LinkedElement>()
+                                               ?: listOf()
                        } else {
-                               listOf<LinkedElement>()
+                               listOf()
                        }
 
        private fun showLinkedImages(currentSone: Sone?, sone: Sone?): Boolean {
index 2f7bd6e..6d1d413 100644 (file)
@@ -1,6 +1,6 @@
 package net.pterodactylus.sone.utils
 
-fun <T> T?.asList() = this?.let(::listOf) ?: emptyList<T>()
+fun <T> T?.asList() = this?.let(::listOf) ?: emptyList()
 val Any?.unit get() = Unit
 
 fun <T> T?.throwOnNullIf(throwCondition: Boolean, exception: () -> Throwable) =
index 3330e78..772d9c4 100644 (file)
@@ -43,4 +43,4 @@ class Pagination<out T>(private val originalItems: List<T>, pageSize: Int): Iter
 
 }
 
-fun <T> Iterable<T>.paginate(pageSize: Int) = Pagination<T>(toList(), pageSize)
+fun <T> Iterable<T>.paginate(pageSize: Int) = Pagination(toList(), pageSize)
index 52a4cff..20358c6 100644 (file)
@@ -17,7 +17,7 @@ import org.mockito.Mockito.verify
  */
 class LikePostCommandTest : SoneCommandTest() {
 
-       private val post = createPost("PostId", mock<Sone>(), null, 1000, "Text")
+       private val post = createPost("PostId", mock(), null, 1000, "Text")
 
        override fun createCommand(core: Core) = LikePostCommand(core)
 
@@ -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<Sone>(), mock<Sone>(), mock<Sone>()))
+               whenever(core.getLikes(post)).thenReturn(setOf(mock(), mock(), mock()))
                parameters += "Post" to "PostId"
                parameters += "Sone" to "LocalSoneId"
                val replyParameters = command.execute(parameters).replyParameters
index 54d0c4d..e0df020 100644 (file)
@@ -18,7 +18,7 @@ import org.mockito.Mockito.verify
  */
 class LikeReplyCommandTest : SoneCommandTest() {
 
-       private val reply = createReply("ReplyId", mock<Sone>(), mock<Post>(), 1000, "Text")
+       private val reply = createReply("ReplyId", mock(), mock(), 1000, "Text")
 
        override fun createCommand(core: Core) = LikeReplyCommand(core)
 
@@ -71,7 +71,7 @@ class LikeReplyCommandTest : SoneCommandTest() {
 
        @Test
        fun `request with local sone adds reply id to sone`() {
-               whenever(core.getLikes(reply)).thenReturn(setOf(mock<Sone>(), mock<Sone>(), mock<Sone>()))
+               whenever(core.getLikes(reply)).thenReturn(setOf(mock(), mock(), mock()))
                parameters += "Reply" to "ReplyId"
                parameters += "Sone" to "LocalSoneId"
                val replyParameters = command.execute(parameters).replyParameters
index d0dc7c4..b9c2bcc 100644 (file)
@@ -36,7 +36,7 @@ class FreenetModuleTest {
 
        @Test
        fun `plugin respirator is returned correctly`() {
-               assertThat(injector.getInstance<PluginRespirator>(), sameInstance(pluginRespirator))
+               assertThat(injector.getInstance(), sameInstance(pluginRespirator))
        }
 
        @Test
@@ -46,7 +46,7 @@ class FreenetModuleTest {
 
        @Test
        fun `node is returned correctly`() {
-               assertThat(injector.getInstance<Node>(), sameInstance(node))
+               assertThat(injector.getInstance(), sameInstance(node))
        }
 
        @Test
@@ -56,7 +56,7 @@ class FreenetModuleTest {
 
        @Test
        fun `high level simply client is returned correctly`() {
-               assertThat(injector.getInstance<HighLevelSimpleClient>(), sameInstance(highLevelSimpleClient))
+               assertThat(injector.getInstance(), sameInstance(highLevelSimpleClient))
        }
 
        @Test
@@ -66,7 +66,7 @@ class FreenetModuleTest {
 
        @Test
        fun `session manager is returned correctly`() {
-               assertThat(injector.getInstance<SessionManager>(), sameInstance(sessionManager))
+               assertThat(injector.getInstance(), sameInstance(sessionManager))
        }
 
        @Test
index eb692ba..f7da592 100644 (file)
@@ -17,7 +17,7 @@ class ImageAccessorTest {
 
        private val accessor = ImageAccessor()
        private val album = mock<Album>()
-       private val images = listOf(mock<Image>(), mock<Image>())
+       private val images = listOf(mock<Image>(), mock())
 
        @Before
        fun setupImages() {
index 07cba3d..31bc4eb 100644 (file)
@@ -38,7 +38,7 @@ class LinkedElementRenderFilterTest {
 
        @Test
        fun `filter renders empty span for not loaded elements`() {
-               val html = filter.format(null, LinkedElement("KSK@gpl.png", loading = true), emptyMap<String, Any?>()) as String
+               val html = filter.format(null, LinkedElement("KSK@gpl.png", loading = true), emptyMap()) as String
                val spanNode = Jsoup.parseBodyFragment(html).body().child(0)
                assertThat(spanNode.nodeName(), `is`("span"))
                assertThat(spanNode.attr("class"), `is`("linked-element not-loaded"))
@@ -49,7 +49,7 @@ class LinkedElementRenderFilterTest {
 
        @Test
        fun `filter can render linked images`() {
-               val html = filter.format(null, LinkedElement("KSK@gpl.png", properties = mapOf("type" to "image")), emptyMap<String, Any?>()) as String
+               val html = filter.format(null, LinkedElement("KSK@gpl.png", properties = mapOf("type" to "image")), emptyMap()) as String
                val outerSpanNode = Jsoup.parseBodyFragment(html).body().child(0)
                assertThat(outerSpanNode.nodeName(), `is`("span"))
                assertThat(outerSpanNode.attr("class"), `is`("linked-element loaded"))
@@ -63,7 +63,7 @@ class LinkedElementRenderFilterTest {
 
        @Test
        fun `filter can render HTML pages`() {
-               val html = filter.format(null, LinkedElement("KSK@gpl.html", properties = mapOf("type" to "html", "title" to "Page Title", "description" to "This is the description.")), emptyMap<String, Any?>()) as String
+               val html = filter.format(null, LinkedElement("KSK@gpl.html", properties = mapOf("type" to "html", "title" to "Page Title", "description" to "This is the description.")), emptyMap()) as String
                val outerSpanNode = Jsoup.parseBodyFragment(html).body().child(0)
                assertThat(outerSpanNode.nodeName(), equalTo("span"))
                assertThat(outerSpanNode.attr("class"), `is`("linked-element loaded"))
index 717d3c5..a2c4ad7 100644 (file)
@@ -61,7 +61,7 @@ class ProfileAccessorTest {
 
        @Before
        fun setupCore() {
-               whenever(core.getImage(eq("avatar-id"), anyBoolean())).thenReturn(mock<Image>())
+               whenever(core.getImage(eq("avatar-id"), anyBoolean())).thenReturn(mock())
        }
 
 
index f06069b..f8ac06d 100644 (file)
@@ -34,7 +34,7 @@ class ReplyAccessorTest {
 
        @Test
        fun `returns the likes correctly`() {
-               val sones = setOf(mock<Sone>(), mock<Sone>(), mock<Sone>())
+               val sones = setOf(mock<Sone>(), mock(), mock())
                whenever(core.getLikes(reply)).thenReturn(sones)
                assertThat(accessor.get(templateContext, reply, "likes"), equalTo<Any>(sones))
        }
@@ -74,7 +74,7 @@ class ReplyAccessorTest {
 
        @Test
        fun `return that a reply is loaded if its sone is not null`() {
-               whenever(reply.sone).thenReturn(mock<Sone>())
+               whenever(reply.sone).thenReturn(mock())
                assertThat(accessor.get(templateContext, reply, "loaded"), equalTo<Any>(true))
        }
 
index 2fe40d4..87cfce0 100644 (file)
@@ -128,7 +128,7 @@ class SoneAccessorTest {
 
        @Test
        fun `accessor returns that the sone’s status is not unknown if it is not unknown`() {
-               whenever(sone.status).thenReturn(mock<SoneStatus>())
+               whenever(sone.status).thenReturn(mock())
                assertAccessorReturnValue("unknown", false)
        }
 
@@ -140,7 +140,7 @@ class SoneAccessorTest {
 
        @Test
        fun `accessor returns that the sone’s status is not idle if it is not idle`() {
-               whenever(sone.status).thenReturn(mock<SoneStatus>())
+               whenever(sone.status).thenReturn(mock())
                assertAccessorReturnValue("idle", false)
        }
 
@@ -152,7 +152,7 @@ class SoneAccessorTest {
 
        @Test
        fun `accessor returns that the sone’s status is not inserting if it is not inserting`() {
-               whenever(sone.status).thenReturn(mock<SoneStatus>())
+               whenever(sone.status).thenReturn(mock())
                assertAccessorReturnValue("inserting", false)
        }
 
@@ -164,7 +164,7 @@ class SoneAccessorTest {
 
        @Test
        fun `accessor returns that the sone’s status is not downloading if it is not downloading`() {
-               whenever(sone.status).thenReturn(mock<SoneStatus>())
+               whenever(sone.status).thenReturn(mock())
                assertAccessorReturnValue("downloading", false)
        }
 
@@ -217,7 +217,7 @@ class SoneAccessorTest {
 
        @Test
        fun `accessor returns all images in the correct order`() {
-               val images = listOf(mock<Image>(), mock<Image>(), mock<Image>(), mock<Image>(), mock<Image>())
+               val images = listOf(mock<Image>(), mock(), mock(), mock(), mock())
                val firstAlbum = createAlbum(listOf(), listOf(images[0], images[3]))
                val secondAlbum = createAlbum(listOf(), listOf(images[1], images[4], images[2]))
                val rootAlbum = createAlbum(listOf(firstAlbum, secondAlbum), listOf())
@@ -233,7 +233,7 @@ class SoneAccessorTest {
 
        @Test
        fun `accessor returns all albums in the correct order`() {
-               val albums = listOf(mock<Album>(), mock<Album>(), mock<Album>(), mock<Album>(), mock<Album>())
+               val albums = listOf(mock<Album>(), mock(), mock(), mock(), mock())
                val rootAlbum = createAlbum(albums, listOf())
                whenever(sone.rootAlbum).thenReturn(rootAlbum)
                assertAccessorReturnValueMatches("albums", contains(*albums.toTypedArray()))
index f5f52b8..f9119c3 100644 (file)
@@ -8,7 +8,7 @@ import kotlin.reflect.KClass
 fun <T : Any> KClass<T>.isProvidedBy(instance: T) = Module { it.bind(this.java).toProvider { instance } }
 fun <T : Any> KClass<T>.isProvidedBy(provider: com.google.inject.Provider<T>) = Module { it.bind(this.java).toProvider(provider) }
 fun <T : Any> KClass<T>.isProvidedBy(provider: KClass<out Provider<T>>) = Module { it.bind(this.java).toProvider(provider.java) }
-inline fun <reified T : Any> KClass<T>.isProvidedByMock() = Module { it.bind(this.java).toProvider { mock<T>() } }
+inline fun <reified T : Any> KClass<T>.isProvidedByMock() = Module { it.bind(this.java).toProvider { mock() } }
 
 inline fun <reified T : Any> Injector.getInstance() = getInstance(T::class.java)!!
 
index c4fd7cb..d1ab1fc 100644 (file)
@@ -18,11 +18,11 @@ inline fun <reified T : Any> bind(implementation: T): Module =
                Module { it!!.bind(T::class.java).toInstance(implementation) }
 
 inline fun <reified T : Any> bindMock(): Module =
-               Module { it!!.bind(T::class.java).toInstance(mock<T>()) }
+               Module { it!!.bind(T::class.java).toInstance(mock()) }
 
 inline fun <reified T: Any?> whenever(methodCall: T) = Mockito.`when`(methodCall)!!
 
-inline fun <reified T : Any> OngoingStubbing<T>.thenReturnMock(): OngoingStubbing<T> = this.thenReturn(mock<T>())
+inline fun <reified T : Any> OngoingStubbing<T>.thenReturnMock(): OngoingStubbing<T> = this.thenReturn(mock())
 
 operator fun <T> InvocationOnMock.get(index: Int): T = getArgument(index)
 
index f0cceca..ac6e955 100644 (file)
@@ -9,7 +9,7 @@ class OneByOneMatcher<A> : TypeSafeDiagnosingMatcher<A>() {
        private val matchers = mutableListOf<Matcher<A, *>>()
 
        fun <V> expect(description: String, expected: V, actual: (A) -> V) {
-               matchers += Matcher<A, V>(expected, actual, description)
+               matchers += Matcher(expected, actual, description)
        }
 
        override fun describeTo(description: Description) {
index 361bd19..31fca48 100644 (file)
@@ -16,7 +16,7 @@ class SonePartTest {
        private val sone = mock<Sone>()
 
        init {
-               `when`(sone.profile).thenReturn(mock<Profile>())
+               `when`(sone.profile).thenReturn(mock())
                `when`(sone.name).thenReturn("sone")
        }
 
index 3ce20ce..d3f063d 100644 (file)
@@ -12,7 +12,7 @@ import org.junit.Test
 class PaginationTest {
 
        private val items = listOf(1, 2, 3, 4, 5)
-       private val pagination = Pagination<Int>(items, 2)
+       private val pagination = Pagination(items, 2)
 
        @Test
        fun `pagination can be created from iterable`() {
index a7fd486..95ffa00 100644 (file)
@@ -99,7 +99,7 @@ class DeleteAlbumPageTest: WebPageTest(::DeleteAlbumPage) {
        fun `album is deleted and page redirects to album if parent album is not root album`() {
                setMethod(POST)
                whenever(parentAlbum.isRoot).thenReturn(false)
-               whenever(sone.rootAlbum).thenReturn(mock<Album>())
+               whenever(sone.rootAlbum).thenReturn(mock())
                addAlbum("album-id", album)
                addHttpRequestPart("album", "album-id")
                verifyRedirect("imageBrowser.html?album=parent-id") {
index d54fc2d..a9763e0 100644 (file)
@@ -53,7 +53,7 @@ class KnownSonesPageTest: WebPageTest(::KnownSonesPage) {
                        whenever(albums).thenReturn(listOf(album))
                }
                whenever(this.rootAlbum).thenReturn(rootAlbum)
-               whenever(this.profile).thenReturn(mock<Profile>())
+               whenever(this.profile).thenReturn(mock())
                whenever(id).thenReturn(name.toLowerCase())
                whenever(this.name).thenReturn(name)
        }
index eeb7ca7..2c6dbae 100644 (file)
@@ -40,7 +40,7 @@ class MarkAsKnownPageTest: WebPageTest(::MarkAsKnownPage) {
                addHttpRequestPart("returnPage", "return.html")
                addHttpRequestPart("type", "post")
                addHttpRequestPart("id", "post1 post2 post3")
-               val posts = listOf(mock<Post>(), mock<Post>())
+               val posts = listOf(mock<Post>(), mock())
                addPost("post1", posts[0])
                addPost("post3", posts[1])
                verifyRedirect("return.html") {
@@ -55,7 +55,7 @@ class MarkAsKnownPageTest: WebPageTest(::MarkAsKnownPage) {
                addHttpRequestPart("returnPage", "return.html")
                addHttpRequestPart("type", "reply")
                addHttpRequestPart("id", "reply1 reply2 reply3")
-               val replies = listOf(mock<PostReply>(), mock<PostReply>())
+               val replies = listOf(mock<PostReply>(), mock())
                addPostReply("reply1", replies[0])
                addPostReply("reply3", replies[1])
                verifyRedirect("return.html") {
@@ -70,7 +70,7 @@ class MarkAsKnownPageTest: WebPageTest(::MarkAsKnownPage) {
                addHttpRequestPart("returnPage", "return.html")
                addHttpRequestPart("type", "sone")
                addHttpRequestPart("id", "sone1 sone2 sone3")
-               val sones = listOf(mock<Sone>(), mock<Sone>())
+               val sones = listOf(mock<Sone>(), mock())
                addSone("sone1", sones[0])
                addSone("sone3", sones[1])
                verifyRedirect("return.html") {
index 9027cb4..5c71e5d 100644 (file)
@@ -47,7 +47,7 @@ class NewPageTest: WebPageTest(::NewPage) {
        fun `posts are not duplicated when they come from both new posts and new replies notifications`() {
                val extraPost = mock<Post>().withTime(2000)
                val posts = asList(mock<Post>().withTime(1000), mock<Post>().withTime(3000))
-               val postReplies = asList(mock<PostReply>(), mock<PostReply>())
+               val postReplies = asList(mock<PostReply>(), mock())
                whenever(postReplies[0].post).thenReturn(posts[0].asOptional())
                whenever(postReplies[1].post).thenReturn(extraPost.asOptional())
                whenever(webInterface.getNewPosts(currentSone)).thenReturn(posts)
index b0aee64..2da2b24 100644 (file)
@@ -73,21 +73,21 @@ class SearchPageTest: WebPageTest({ template, webInterface -> SearchPage(templat
 
        @Test
        fun `searching for sone link without prefix redirects to view sone page`() {
-               addSone("sone-id", mock<Sone>())
+               addSone("sone-id", mock())
                addHttpRequestParameter("query", "sone-id")
                verifyRedirect("viewSone.html?sone=sone-id")
        }
 
        @Test
        fun `searching for a post link redirects to post page`() {
-               addPost("Post-id", mock<Post>())
+               addPost("Post-id", mock())
                addHttpRequestParameter("query", "post://Post-id")
                verifyRedirect("viewPost.html?post=Post-id")
        }
 
        @Test
        fun `searching for a post ID without prefix redirects to post page`() {
-               addPost("post-id", mock<Post>())
+               addPost("post-id", mock())
                addHttpRequestParameter("query", "post-id")
                verifyRedirect("viewPost.html?post=post-id")
        }
@@ -110,28 +110,28 @@ class SearchPageTest: WebPageTest({ template, webInterface -> SearchPage(templat
 
        @Test
        fun `searching for an album link redirects to the image browser`() {
-               addAlbum("album-id", mock<Album>())
+               addAlbum("album-id", mock())
                addHttpRequestParameter("query", "album://album-id")
                verifyRedirect("imageBrowser.html?album=album-id")
        }
 
        @Test
        fun `searching for an album ID redirects to the image browser`() {
-               addAlbum("album-id", mock<Album>())
+               addAlbum("album-id", mock())
                addHttpRequestParameter("query", "album-id")
                verifyRedirect("imageBrowser.html?album=album-id")
        }
 
        @Test
        fun `searching for an image link redirects to the image browser`() {
-               addImage("image-id", mock<Image>())
+               addImage("image-id", mock())
                addHttpRequestParameter("query", "image://image-id")
                verifyRedirect("imageBrowser.html?image=image-id")
        }
 
        @Test
        fun `searching for an image ID redirects to the image browser`() {
-               addImage("image-id", mock<Image>())
+               addImage("image-id", mock())
                addHttpRequestParameter("query", "image-id")
                verifyRedirect("imageBrowser.html?image=image-id")
        }
index d8425d3..7e92224 100644 (file)
@@ -78,7 +78,7 @@ class SoneTemplatePageTest : WebPageTest({ template, webInterface -> object : So
 
        @Test
        fun `local sones are set in template context`() {
-               val localSones = listOf(mock<Sone>(), mock<Sone>())
+               val localSones = listOf(mock<Sone>(), mock())
                whenever(core.localSones).thenReturn(localSones)
                verifyVariableMatches("localSones", containsInAnyOrder(*localSones.toTypedArray()))
        }
index 1c1ca7f..0fff35c 100644 (file)
@@ -59,7 +59,7 @@ class UnlockSonePageTest: WebPageTest(::UnlockSonePage) {
                setMethod(POST)
                addHttpRequestPart("returnPage", "return.html")
                addHttpRequestPart("sone", "remote-sone")
-               addSone("remote-sone", mock<Sone>())
+               addSone("remote-sone", mock())
                verifyRedirect("return.html") {
                        verify(core, never()).unlockSone(any())
                }
index a60c4a7..fe76737 100644 (file)
@@ -64,7 +64,7 @@ class UploadImagePageTest: WebPageTest(::UploadImagePage) {
        fun `post request with parent that is not the current sone results in no permission error page`() {
                setMethod(POST)
                addHttpRequestPart("parent", "parent-id")
-               whenever(parentAlbum.sone).thenReturn(mock<Sone>())
+               whenever(parentAlbum.sone).thenReturn(mock())
                addAlbum("parent-id", parentAlbum)
                verifyRedirect("noPermission.html")
        }
index 67adb8f..ea1f528 100644 (file)
@@ -30,11 +30,11 @@ class ViewSonePageTest: WebPageTest(::ViewSonePage) {
 
        private val post1 = createPost("post1", "First Post.", 1000, currentSone)
        private val post2 = createPost("post2", "Second Post.", 2000, currentSone)
-       private val foreignPost1 = createPost("foreign-post1", "First Foreign Post.", 1000, mock<Sone>())
-       private val foreignPost2 = createPost("foreign-post2", "Second Foreign Post.", 2000, mock<Sone>())
-       private val foreignPost3 = createPost("foreign-post3", "Third Foreign Post.", 3000, mock<Sone>())
-       private val directed1 = createPost("post3", "First directed.", 1500, mock<Sone>(), recipient = currentSone)
-       private val directed2 = createPost("post4", "Second directed.", 2500, mock<Sone>(), recipient = currentSone)
+       private val foreignPost1 = createPost("foreign-post1", "First Foreign Post.", 1000, mock())
+       private val foreignPost2 = createPost("foreign-post2", "Second Foreign Post.", 2000, mock())
+       private val foreignPost3 = createPost("foreign-post3", "Third Foreign Post.", 3000, mock())
+       private val directed1 = createPost("post3", "First directed.", 1500, mock(), recipient = currentSone)
+       private val directed2 = createPost("post4", "Second directed.", 2500, mock(), recipient = currentSone)
 
        @Before
        fun setup() {
index ce16c85..4f72902 100644 (file)
@@ -42,7 +42,7 @@ import kotlin.text.Charsets.UTF_8
 /**
  * Base class for web page tests.
  */
-open class WebPageTest(pageSupplier: (Template, WebInterface) -> SoneTemplatePage = { _, _ -> mock<SoneTemplatePage>() }) {
+open class WebPageTest(pageSupplier: (Template, WebInterface) -> SoneTemplatePage = { _, _ -> mock() }) {
 
        val currentSone = mock<Sone>()
        val template = mock<Template>()
@@ -164,7 +164,7 @@ open class WebPageTest(pageSupplier: (Template, WebInterface) -> SoneTemplatePag
        }
 
        fun addHttpRequestParameter(name: String, value: String) {
-               getRequestParameters[name] = getRequestParameters.getOrElse(name) { mutableListOf<String>() }.apply { add(value) }
+               getRequestParameters[name] = getRequestParameters.getOrElse(name) { mutableListOf() }.apply { add(value) }
        }
 
        fun addHttpRequestPart(name: String, value: String) {