1 package net.pterodactylus.sone.template
3 import net.pterodactylus.sone.freenet.wot.Trust
4 import org.hamcrest.MatcherAssert.assertThat
5 import org.hamcrest.Matchers.equalTo
9 * Unit test for [TrustAccessor].
11 class TrustAccessorTest {
13 private val accessor = TrustAccessor()
16 fun `accessor returns false if there is no explicit trust assigned`() {
17 assertThat(accessor.get(null, Trust(null, null, null), "assigned"), equalTo<Any>(false))
21 fun `accessor returns true if there is explicit trust assigned`() {
22 assertThat(accessor.get(null, Trust(0, null, null), "assigned"), equalTo<Any>(true))
26 fun `reflection accessor is used for other members`() {
27 assertThat(accessor.get(null, Trust(0, 0, 0), "hashCode"), equalTo<Any>(Trust(0, 0, 0).hashCode()))