From b464f91668b1985e59b5555450011783da771211 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 31 Mar 2019 20:15:03 -0400 Subject: Add stricter parsing tests --- .../kotlin/com/pitchedapps/frost/facebook/parsers/FbParseTest.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'app/src/test/kotlin/com') diff --git a/app/src/test/kotlin/com/pitchedapps/frost/facebook/parsers/FbParseTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/facebook/parsers/FbParseTest.kt index 075f045e..4fe43ca8 100644 --- a/app/src/test/kotlin/com/pitchedapps/frost/facebook/parsers/FbParseTest.kt +++ b/app/src/test/kotlin/com/pitchedapps/frost/facebook/parsers/FbParseTest.kt @@ -22,6 +22,7 @@ import com.pitchedapps.frost.internal.assertDescending import com.pitchedapps.frost.internal.authDependent import org.junit.BeforeClass import org.junit.Test +import kotlin.test.assertFalse import kotlin.test.assertNotNull import kotlin.test.assertTrue import kotlin.test.fail @@ -39,13 +40,14 @@ class FbParseTest { } } - private inline fun FrostParser.test(action: T.() -> Unit = {}) = + private inline fun FrostParser.test(action: T.() -> Unit = {}) = parse(COOKIE).test(url, action) - private inline fun ParseResponse?.test(url: String, action: T.() -> Unit = {}) { + private inline fun ParseResponse?.test(url: String, action: T.() -> Unit = {}) { val response = this ?: fail("${T::class.simpleName} parser returned null for $url") println(response) + assertFalse(response.data.isEmpty, "${T::class.simpleName} parser returned empty data for $url") response.data.action() } -- cgit v1.2.3