X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Ftemplate%2FProfileAccessorTest.kt;h=53d473e98699a35c9fbc24b849349c448cba572a;hp=a2c4ad7923455e3ab9465ec6c71a35bb718383e7;hb=64740709990291688170ebd1f192af5eb9090618;hpb=03cec6a6772c2d836d94864adddaf544cbe9d72f diff --git a/src/test/kotlin/net/pterodactylus/sone/template/ProfileAccessorTest.kt b/src/test/kotlin/net/pterodactylus/sone/template/ProfileAccessorTest.kt index a2c4ad7..53d473e 100644 --- a/src/test/kotlin/net/pterodactylus/sone/template/ProfileAccessorTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/template/ProfileAccessorTest.kt @@ -1,7 +1,6 @@ package net.pterodactylus.sone.template import net.pterodactylus.sone.core.Core -import net.pterodactylus.sone.data.Image import net.pterodactylus.sone.data.Profile import net.pterodactylus.sone.data.Sone import net.pterodactylus.sone.data.SoneOptions.DefaultSoneOptions @@ -17,7 +16,7 @@ import net.pterodactylus.sone.test.mock import net.pterodactylus.sone.test.whenever import net.pterodactylus.util.template.TemplateContext import org.hamcrest.MatcherAssert.assertThat -import org.hamcrest.Matchers.`is` +import org.hamcrest.Matchers.equalTo import org.hamcrest.Matchers.nullValue import org.junit.Before import org.junit.Test @@ -86,7 +85,7 @@ class ProfileAccessorTest { @Test fun `avatar ID is returned if profile belongs to local sone`() { whenever(remoteSone.isLocal).thenReturn(true) - assertThat(accessor.get(templateContext, profile, "avatar"), `is`("avatar-id")) + assertThat(accessor.get(templateContext, profile, "avatar"), equalTo("avatar-id")) } @Test @@ -98,14 +97,14 @@ class ProfileAccessorTest { @Test fun `avatar ID is returned if sone is configure to always show avatars`() { currentSone.options.showCustomAvatars = ALWAYS - assertThat(accessor.get(templateContext, profile, "avatar"), `is`("avatar-id")) + assertThat(accessor.get(templateContext, profile, "avatar"), equalTo("avatar-id")) } @Test fun `avatar ID is returned if sone is configure to show avatars of followed sones and remote sone is followed`() { currentSone.options.showCustomAvatars = FOLLOWED whenever(currentSone.hasFriend("remote-sone")).thenReturn(true) - assertThat(accessor.get(templateContext, profile, "avatar"), `is`("avatar-id")) + assertThat(accessor.get(templateContext, profile, "avatar"), equalTo("avatar-id")) } @Test @@ -142,7 +141,7 @@ class ProfileAccessorTest { fun `avatar ID is returned if sone is configure to show avatars based on manual trust and explicit trust is one`() { currentSone.options.showCustomAvatars = MANUALLY_TRUSTED setTrust(Trust(1, null, null)) - assertThat(accessor.get(templateContext, profile, "avatar"), `is`("avatar-id")) + assertThat(accessor.get(templateContext, profile, "avatar"), equalTo("avatar-id")) } @Test @@ -156,7 +155,7 @@ class ProfileAccessorTest { fun `avatar ID is returned if sone is configure to show avatars based on trust and explicit trust is one`() { currentSone.options.showCustomAvatars = TRUSTED setTrust(Trust(1, null, null)) - assertThat(accessor.get(templateContext, profile, "avatar"), `is`("avatar-id")) + assertThat(accessor.get(templateContext, profile, "avatar"), equalTo("avatar-id")) } @Test @@ -177,12 +176,12 @@ class ProfileAccessorTest { fun `avatar ID is returned if sone is configure to show avatars based on trust and implicit trust is one`() { currentSone.options.showCustomAvatars = TRUSTED setTrust(Trust(0, 1, null)) - assertThat(accessor.get(templateContext, profile, "avatar"), `is`("avatar-id")) + assertThat(accessor.get(templateContext, profile, "avatar"), equalTo("avatar-id")) } @Test fun `accessing other members uses reflection accessor`() { - assertThat(accessor.get(templateContext, profile, "hashCode"), `is`(profile.hashCode())) + assertThat(accessor.get(templateContext, profile, "hashCode"), equalTo(profile.hashCode())) } }