X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Ftest%2FMatchers.kt;h=ecb20492e2d4e0da7fc60b9b2f08ff7eed61e324;hb=a72774c302cdb2c35508380fb2ec445be2705efe;hp=85ed9e7ee4004557c8f2bd4828dcd40411dbda89;hpb=faf66247a34f64946990a985d2ea3003465969cb;p=Sone.git diff --git a/src/test/kotlin/net/pterodactylus/sone/test/Matchers.kt b/src/test/kotlin/net/pterodactylus/sone/test/Matchers.kt index 85ed9e7..ecb2049 100644 --- a/src/test/kotlin/net/pterodactylus/sone/test/Matchers.kt +++ b/src/test/kotlin/net/pterodactylus/sone/test/Matchers.kt @@ -1,11 +1,11 @@ package net.pterodactylus.sone.test import freenet.support.* +import net.pterodactylus.sone.data.Post import net.pterodactylus.sone.freenet.wot.* import net.pterodactylus.sone.utils.* import net.pterodactylus.util.web.* import org.hamcrest.* -import org.hamcrest.Matchers import org.hamcrest.Matchers.* /** @@ -107,6 +107,9 @@ fun hasField(name: String, valueMatcher: Matcher) = object : TypeSafeDia } } +fun isPost(isRecipientId: Matcher = any(String::class.java)) = AttributeMatcher("post") + .addAttribute("recipient ID", { it.recipientId.orNull() }, isRecipientId) + /** * [TypeSafeDiagnosingMatcher] implementation that aims to cut down boilerplate on verifying the attributes * of typical container objects.