🚧 Add matcher for trust values
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 1 Nov 2019 17:36:26 +0000 (18:36 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 1 Nov 2019 17:36:26 +0000 (18:36 +0100)
src/test/kotlin/net/pterodactylus/sone/test/Matchers.kt

index 83da2ae..3bbdd23 100644 (file)
@@ -1,5 +1,6 @@
 package net.pterodactylus.sone.test
 
+import net.pterodactylus.sone.freenet.wot.*
 import net.pterodactylus.sone.utils.*
 import net.pterodactylus.util.web.*
 import org.hamcrest.*
@@ -32,3 +33,9 @@ fun <K, V> isEmptyMap() = object : TypeSafeDiagnosingMatcher<Map<K, V>>() {
                        }
 }
 
+fun isTrust(trust: Int?, score: Int?, rank: Int?) =
+               AttributeMatcher<Trust>("trust")
+                               .addAttribute("trust", trust, Trust::explicit)
+                               .addAttribute("score", score, Trust::implicit)
+                               .addAttribute("rank", rank, Trust::distance)
+