X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftemplate%2FImageAccessorTest.kt;fp=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftemplate%2FImageAccessorTest.kt;h=0000000000000000000000000000000000000000;hb=0a481aacb47d7c1e90c1c212a58f87af29e3ebb6;hp=eb692ba44edfff812256b40f8863292dd5afa78f;hpb=31de5826e7dd5d063a9c81152326d80ab87105eb;p=Sone.git diff --git a/src/test/java/net/pterodactylus/sone/template/ImageAccessorTest.kt b/src/test/java/net/pterodactylus/sone/template/ImageAccessorTest.kt deleted file mode 100644 index eb692ba..0000000 --- a/src/test/java/net/pterodactylus/sone/template/ImageAccessorTest.kt +++ /dev/null @@ -1,55 +0,0 @@ -package net.pterodactylus.sone.template - -import net.pterodactylus.sone.data.Album -import net.pterodactylus.sone.data.Image -import net.pterodactylus.sone.test.mock -import net.pterodactylus.sone.test.whenever -import org.hamcrest.MatcherAssert.assertThat -import org.hamcrest.Matchers.equalTo -import org.hamcrest.Matchers.nullValue -import org.junit.Before -import org.junit.Test - -/** - * Unit test for [ImageAccessor]. - */ -class ImageAccessorTest { - - private val accessor = ImageAccessor() - private val album = mock() - private val images = listOf(mock(), mock()) - - @Before - fun setupImages() { - whenever(album.images).thenReturn(images) - images.forEach { - whenever(it.album).thenReturn(album) - } - } - - @Test - fun `accessor returns next image for first image`() { - assertThat(accessor.get(null, images[0], "next"), equalTo(images[1])) - } - - @Test - fun `accessor returns null for next image of second image`() { - assertThat(accessor.get(null, images[1], "next"), nullValue()) - } - - @Test - fun `accessor returns previous image for second image`() { - assertThat(accessor.get(null, images[1], "previous"), equalTo(images[0])) - } - - @Test - fun `accessor returns null for previous image of first image`() { - assertThat(accessor.get(null, images[0], "previous"), nullValue()) - } - - @Test - fun `accessor uses reflection accessor for all other members`() { - assertThat(accessor.get(null, images[0], "hashCode"), equalTo(images[0].hashCode())) - } - -}