From: David ‘Bombe’ Roden Date: Fri, 22 Feb 2019 23:11:19 +0000 (+0100) Subject: Remove unnecessary type parameters X-Git-Tag: v79^2~100 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=03c29a3838e23ed0b9731ca4d84cf58038c30dfe;p=Sone.git Remove unnecessary type parameters --- diff --git a/src/main/kotlin/net/pterodactylus/sone/template/LinkedElementsFilter.kt b/src/main/kotlin/net/pterodactylus/sone/template/LinkedElementsFilter.kt index c9414ea..0ed8df2 100644 --- a/src/main/kotlin/net/pterodactylus/sone/template/LinkedElementsFilter.kt +++ b/src/main/kotlin/net/pterodactylus/sone/template/LinkedElementsFilter.kt @@ -27,9 +27,9 @@ class LinkedElementsFilter(private val elementLoader: ElementLoader) : Filter { ?.filterIsInstance() ?.map { elementLoader.loadElement(it.link) } ?.filter { !it.failed } - ?: listOf() + ?: listOf() } else { - listOf() + listOf() } private fun showLinkedImages(currentSone: Sone?, sone: Sone?): Boolean { diff --git a/src/main/kotlin/net/pterodactylus/sone/utils/Objects.kt b/src/main/kotlin/net/pterodactylus/sone/utils/Objects.kt index 2f7bd6e..6d1d413 100644 --- a/src/main/kotlin/net/pterodactylus/sone/utils/Objects.kt +++ b/src/main/kotlin/net/pterodactylus/sone/utils/Objects.kt @@ -1,6 +1,6 @@ package net.pterodactylus.sone.utils -fun T?.asList() = this?.let(::listOf) ?: emptyList() +fun T?.asList() = this?.let(::listOf) ?: emptyList() val Any?.unit get() = Unit fun T?.throwOnNullIf(throwCondition: Boolean, exception: () -> Throwable) = diff --git a/src/main/kotlin/net/pterodactylus/sone/utils/Pagination.kt b/src/main/kotlin/net/pterodactylus/sone/utils/Pagination.kt index 3330e78..772d9c4 100644 --- a/src/main/kotlin/net/pterodactylus/sone/utils/Pagination.kt +++ b/src/main/kotlin/net/pterodactylus/sone/utils/Pagination.kt @@ -43,4 +43,4 @@ class Pagination(private val originalItems: List, pageSize: Int): Iter } -fun Iterable.paginate(pageSize: Int) = Pagination(toList(), pageSize) +fun Iterable.paginate(pageSize: Int) = Pagination(toList(), pageSize) diff --git a/src/test/kotlin/net/pterodactylus/sone/fcp/LikePostCommandTest.kt b/src/test/kotlin/net/pterodactylus/sone/fcp/LikePostCommandTest.kt index 52a4cff..20358c6 100644 --- a/src/test/kotlin/net/pterodactylus/sone/fcp/LikePostCommandTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/fcp/LikePostCommandTest.kt @@ -17,7 +17,7 @@ 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) @@ -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 diff --git a/src/test/kotlin/net/pterodactylus/sone/fcp/LikeReplyCommandTest.kt b/src/test/kotlin/net/pterodactylus/sone/fcp/LikeReplyCommandTest.kt index 54d0c4d..e0df020 100644 --- a/src/test/kotlin/net/pterodactylus/sone/fcp/LikeReplyCommandTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/fcp/LikeReplyCommandTest.kt @@ -18,7 +18,7 @@ import org.mockito.Mockito.verify */ class LikeReplyCommandTest : SoneCommandTest() { - private val reply = createReply("ReplyId", mock(), mock(), 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(), mock(), mock())) + whenever(core.getLikes(reply)).thenReturn(setOf(mock(), mock(), mock())) parameters += "Reply" to "ReplyId" parameters += "Sone" to "LocalSoneId" val replyParameters = command.execute(parameters).replyParameters diff --git a/src/test/kotlin/net/pterodactylus/sone/main/FreenetModuleTest.kt b/src/test/kotlin/net/pterodactylus/sone/main/FreenetModuleTest.kt index d0dc7c4..b9c2bcc 100644 --- a/src/test/kotlin/net/pterodactylus/sone/main/FreenetModuleTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/main/FreenetModuleTest.kt @@ -36,7 +36,7 @@ class FreenetModuleTest { @Test fun `plugin respirator is returned correctly`() { - assertThat(injector.getInstance(), sameInstance(pluginRespirator)) + assertThat(injector.getInstance(), sameInstance(pluginRespirator)) } @Test @@ -46,7 +46,7 @@ class FreenetModuleTest { @Test fun `node is returned correctly`() { - assertThat(injector.getInstance(), 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(), sameInstance(highLevelSimpleClient)) + assertThat(injector.getInstance(), sameInstance(highLevelSimpleClient)) } @Test @@ -66,7 +66,7 @@ class FreenetModuleTest { @Test fun `session manager is returned correctly`() { - assertThat(injector.getInstance(), sameInstance(sessionManager)) + assertThat(injector.getInstance(), sameInstance(sessionManager)) } @Test diff --git a/src/test/kotlin/net/pterodactylus/sone/template/ImageAccessorTest.kt b/src/test/kotlin/net/pterodactylus/sone/template/ImageAccessorTest.kt index eb692ba..f7da592 100644 --- a/src/test/kotlin/net/pterodactylus/sone/template/ImageAccessorTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/template/ImageAccessorTest.kt @@ -17,7 +17,7 @@ class ImageAccessorTest { private val accessor = ImageAccessor() private val album = mock() - private val images = listOf(mock(), mock()) + private val images = listOf(mock(), mock()) @Before fun setupImages() { diff --git a/src/test/kotlin/net/pterodactylus/sone/template/LinkedElementRenderFilterTest.kt b/src/test/kotlin/net/pterodactylus/sone/template/LinkedElementRenderFilterTest.kt index 07cba3d..31bc4eb 100644 --- a/src/test/kotlin/net/pterodactylus/sone/template/LinkedElementRenderFilterTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/template/LinkedElementRenderFilterTest.kt @@ -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()) 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()) 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()) 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")) diff --git a/src/test/kotlin/net/pterodactylus/sone/template/ProfileAccessorTest.kt b/src/test/kotlin/net/pterodactylus/sone/template/ProfileAccessorTest.kt index 717d3c5..a2c4ad7 100644 --- a/src/test/kotlin/net/pterodactylus/sone/template/ProfileAccessorTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/template/ProfileAccessorTest.kt @@ -61,7 +61,7 @@ class ProfileAccessorTest { @Before fun setupCore() { - whenever(core.getImage(eq("avatar-id"), anyBoolean())).thenReturn(mock()) + whenever(core.getImage(eq("avatar-id"), anyBoolean())).thenReturn(mock()) } diff --git a/src/test/kotlin/net/pterodactylus/sone/template/ReplyAccessorTest.kt b/src/test/kotlin/net/pterodactylus/sone/template/ReplyAccessorTest.kt index f06069b..f8ac06d 100644 --- a/src/test/kotlin/net/pterodactylus/sone/template/ReplyAccessorTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/template/ReplyAccessorTest.kt @@ -34,7 +34,7 @@ class ReplyAccessorTest { @Test fun `returns the likes correctly`() { - val sones = setOf(mock(), mock(), mock()) + val sones = setOf(mock(), mock(), mock()) whenever(core.getLikes(reply)).thenReturn(sones) assertThat(accessor.get(templateContext, reply, "likes"), equalTo(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()) + whenever(reply.sone).thenReturn(mock()) assertThat(accessor.get(templateContext, reply, "loaded"), equalTo(true)) } diff --git a/src/test/kotlin/net/pterodactylus/sone/template/SoneAccessorTest.kt b/src/test/kotlin/net/pterodactylus/sone/template/SoneAccessorTest.kt index 2fe40d4..87cfce0 100644 --- a/src/test/kotlin/net/pterodactylus/sone/template/SoneAccessorTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/template/SoneAccessorTest.kt @@ -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()) + 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()) + 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()) + 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()) + 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(), mock(), mock(), mock(), mock()) + val images = listOf(mock(), 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(), mock(), mock(), mock(), mock()) + val albums = listOf(mock(), mock(), mock(), mock(), mock()) val rootAlbum = createAlbum(albums, listOf()) whenever(sone.rootAlbum).thenReturn(rootAlbum) assertAccessorReturnValueMatches("albums", contains(*albums.toTypedArray())) diff --git a/src/test/kotlin/net/pterodactylus/sone/test/Guice.kt b/src/test/kotlin/net/pterodactylus/sone/test/Guice.kt index f5f52b8..f9119c3 100644 --- a/src/test/kotlin/net/pterodactylus/sone/test/Guice.kt +++ b/src/test/kotlin/net/pterodactylus/sone/test/Guice.kt @@ -8,7 +8,7 @@ import kotlin.reflect.KClass fun KClass.isProvidedBy(instance: T) = Module { it.bind(this.java).toProvider { instance } } fun KClass.isProvidedBy(provider: com.google.inject.Provider) = Module { it.bind(this.java).toProvider(provider) } fun KClass.isProvidedBy(provider: KClass>) = Module { it.bind(this.java).toProvider(provider.java) } -inline fun KClass.isProvidedByMock() = Module { it.bind(this.java).toProvider { mock() } } +inline fun KClass.isProvidedByMock() = Module { it.bind(this.java).toProvider { mock() } } inline fun Injector.getInstance() = getInstance(T::class.java)!! diff --git a/src/test/kotlin/net/pterodactylus/sone/test/Mockotlin.kt b/src/test/kotlin/net/pterodactylus/sone/test/Mockotlin.kt index c4fd7cb..d1ab1fc 100644 --- a/src/test/kotlin/net/pterodactylus/sone/test/Mockotlin.kt +++ b/src/test/kotlin/net/pterodactylus/sone/test/Mockotlin.kt @@ -18,11 +18,11 @@ inline fun bind(implementation: T): Module = Module { it!!.bind(T::class.java).toInstance(implementation) } inline fun bindMock(): Module = - Module { it!!.bind(T::class.java).toInstance(mock()) } + Module { it!!.bind(T::class.java).toInstance(mock()) } inline fun whenever(methodCall: T) = Mockito.`when`(methodCall)!! -inline fun OngoingStubbing.thenReturnMock(): OngoingStubbing = this.thenReturn(mock()) +inline fun OngoingStubbing.thenReturnMock(): OngoingStubbing = this.thenReturn(mock()) operator fun InvocationOnMock.get(index: Int): T = getArgument(index) diff --git a/src/test/kotlin/net/pterodactylus/sone/test/OneByOneMatcher.kt b/src/test/kotlin/net/pterodactylus/sone/test/OneByOneMatcher.kt index f0cceca..ac6e955 100644 --- a/src/test/kotlin/net/pterodactylus/sone/test/OneByOneMatcher.kt +++ b/src/test/kotlin/net/pterodactylus/sone/test/OneByOneMatcher.kt @@ -9,7 +9,7 @@ class OneByOneMatcher : TypeSafeDiagnosingMatcher() { private val matchers = mutableListOf>() fun expect(description: String, expected: V, actual: (A) -> V) { - matchers += Matcher(expected, actual, description) + matchers += Matcher(expected, actual, description) } override fun describeTo(description: Description) { diff --git a/src/test/kotlin/net/pterodactylus/sone/text/SonePartTest.kt b/src/test/kotlin/net/pterodactylus/sone/text/SonePartTest.kt index 361bd19..31fca48 100644 --- a/src/test/kotlin/net/pterodactylus/sone/text/SonePartTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/text/SonePartTest.kt @@ -16,7 +16,7 @@ class SonePartTest { private val sone = mock() init { - `when`(sone.profile).thenReturn(mock()) + `when`(sone.profile).thenReturn(mock()) `when`(sone.name).thenReturn("sone") } diff --git a/src/test/kotlin/net/pterodactylus/sone/utils/PaginationTest.kt b/src/test/kotlin/net/pterodactylus/sone/utils/PaginationTest.kt index 3ce20ce..d3f063d 100644 --- a/src/test/kotlin/net/pterodactylus/sone/utils/PaginationTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/utils/PaginationTest.kt @@ -12,7 +12,7 @@ import org.junit.Test class PaginationTest { private val items = listOf(1, 2, 3, 4, 5) - private val pagination = Pagination(items, 2) + private val pagination = Pagination(items, 2) @Test fun `pagination can be created from iterable`() { diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPageTest.kt index a7fd486..95ffa00 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/DeleteAlbumPageTest.kt @@ -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()) + whenever(sone.rootAlbum).thenReturn(mock()) addAlbum("album-id", album) addHttpRequestPart("album", "album-id") verifyRedirect("imageBrowser.html?album=parent-id") { diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPageTest.kt index d54fc2d..a9763e0 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPageTest.kt @@ -53,7 +53,7 @@ class KnownSonesPageTest: WebPageTest(::KnownSonesPage) { whenever(albums).thenReturn(listOf(album)) } whenever(this.rootAlbum).thenReturn(rootAlbum) - whenever(this.profile).thenReturn(mock()) + whenever(this.profile).thenReturn(mock()) whenever(id).thenReturn(name.toLowerCase()) whenever(this.name).thenReturn(name) } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPageTest.kt index eeb7ca7..2c6dbae 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPageTest.kt @@ -40,7 +40,7 @@ class MarkAsKnownPageTest: WebPageTest(::MarkAsKnownPage) { addHttpRequestPart("returnPage", "return.html") addHttpRequestPart("type", "post") addHttpRequestPart("id", "post1 post2 post3") - val posts = listOf(mock(), mock()) + val posts = listOf(mock(), 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(), mock()) + val replies = listOf(mock(), 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(), mock()) + val sones = listOf(mock(), mock()) addSone("sone1", sones[0]) addSone("sone3", sones[1]) verifyRedirect("return.html") { diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/NewPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/NewPageTest.kt index 9027cb4..5c71e5d 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/NewPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/NewPageTest.kt @@ -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().withTime(2000) val posts = asList(mock().withTime(1000), mock().withTime(3000)) - val postReplies = asList(mock(), mock()) + val postReplies = asList(mock(), mock()) whenever(postReplies[0].post).thenReturn(posts[0].asOptional()) whenever(postReplies[1].post).thenReturn(extraPost.asOptional()) whenever(webInterface.getNewPosts(currentSone)).thenReturn(posts) diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/SearchPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/SearchPageTest.kt index b0aee64..2da2b24 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/SearchPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/SearchPageTest.kt @@ -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()) + 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()) + 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()) + 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()) + 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()) + 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()) + 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()) + addImage("image-id", mock()) addHttpRequestParameter("query", "image-id") verifyRedirect("imageBrowser.html?image=image-id") } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePageTest.kt index d8425d3..7e92224 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePageTest.kt @@ -78,7 +78,7 @@ class SoneTemplatePageTest : WebPageTest({ template, webInterface -> object : So @Test fun `local sones are set in template context`() { - val localSones = listOf(mock(), mock()) + val localSones = listOf(mock(), mock()) whenever(core.localSones).thenReturn(localSones) verifyVariableMatches("localSones", containsInAnyOrder(*localSones.toTypedArray())) } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePageTest.kt index 1c1ca7f..0fff35c 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/UnlockSonePageTest.kt @@ -59,7 +59,7 @@ class UnlockSonePageTest: WebPageTest(::UnlockSonePage) { setMethod(POST) addHttpRequestPart("returnPage", "return.html") addHttpRequestPart("sone", "remote-sone") - addSone("remote-sone", mock()) + addSone("remote-sone", mock()) verifyRedirect("return.html") { verify(core, never()).unlockSone(any()) } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/UploadImagePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/UploadImagePageTest.kt index a60c4a7..fe76737 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/UploadImagePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/UploadImagePageTest.kt @@ -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()) + whenever(parentAlbum.sone).thenReturn(mock()) addAlbum("parent-id", parentAlbum) verifyRedirect("noPermission.html") } diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/ViewSonePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/ViewSonePageTest.kt index 67adb8f..ea1f528 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/ViewSonePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/ViewSonePageTest.kt @@ -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()) - 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) + 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() { diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt index ce16c85..4f72902 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest.kt @@ -42,7 +42,7 @@ import kotlin.text.Charsets.UTF_8 /** * Base class for web page tests. */ -open class WebPageTest(pageSupplier: (Template, WebInterface) -> SoneTemplatePage = { _, _ -> mock() }) { +open class WebPageTest(pageSupplier: (Template, WebInterface) -> SoneTemplatePage = { _, _ -> mock() }) { val currentSone = mock() val template = mock