package net.pterodactylus.sone.test
+import freenet.support.*
import net.pterodactylus.sone.freenet.wot.*
import net.pterodactylus.sone.utils.*
import net.pterodactylus.util.web.*
.addAttribute("contexts", OwnIdentity::getContexts, contexts)
.addAttribute("properties", OwnIdentity::getProperties, properties)
+fun hasField(name: String, valueMatcher: Matcher<String>) = object : TypeSafeDiagnosingMatcher<SimpleFieldSet>() {
+ override fun matchesSafely(item: SimpleFieldSet, mismatchDescription: Description) =
+ valueMatcher.matches(item.get(name)).onFalse {
+ valueMatcher.describeMismatch(item, mismatchDescription)
+ }
+
+ override fun describeTo(description: Description) {
+ description
+ .appendText("simple field set with key ").appendValue(name)
+ .appendText(", value ").appendValue(valueMatcher)
+ }
+}
+
/**
* [TypeSafeDiagnosingMatcher] implementation that aims to cut down boilerplate on verifying the attributes
* of typical container objects.