🎨 Store shells instead of full posts in in-memory database
[Sone.git] / src / test / kotlin / net / pterodactylus / sone / test / Matchers.kt
index 1f479f6..ecb2049 100644 (file)
@@ -1,6 +1,7 @@
 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.*
@@ -106,6 +107,9 @@ fun hasField(name: String, valueMatcher: Matcher<String>) = object : TypeSafeDia
        }
 }
 
+fun isPost(isRecipientId: Matcher<String?> = any(String::class.java)) = AttributeMatcher<Post>("post")
+               .addAttribute("recipient ID", { it.recipientId.orNull() }, isRecipientId)
+
 /**
  * [TypeSafeDiagnosingMatcher] implementation that aims to cut down boilerplate on verifying the attributes
  * of typical container objects.