From 53382b44bb7ab7ccb559e96fd1f93c47020878ee Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Wed, 2 Aug 2017 16:21:49 -0700 Subject: Improve video prefetching (#17) * Create base activity and add thumbnails to media picker * Add checker to see if requested permission is inside the manifest * Add faq parser with tests * Add kpref testers and expose sp * Test jitpack sample exclusion * Test caching * Improve glide caching --- .../kotlin/ca/allanwang/kau/xml/FaqTest.kt | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt (limited to 'core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt') diff --git a/core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt b/core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt new file mode 100644 index 0000000..94d1330 --- /dev/null +++ b/core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt @@ -0,0 +1,38 @@ +package ca.allanwang.kau.xml + +import android.support.test.InstrumentationRegistry +import android.support.test.filters.MediumTest +import android.support.test.runner.AndroidJUnit4 +import ca.allanwang.kau.test.R +import org.junit.Test +import org.junit.runner.RunWith +import kotlin.test.assertEquals + +/** + * Created by Allan Wang on 2017-08-01. + */ +@RunWith(AndroidJUnit4::class) +@MediumTest +class FaqTest { + + @Test + fun simpleTest() { + val data = InstrumentationRegistry.getTargetContext().kauParseFaq(R.xml.test_faq) + assertEquals(2, data.size, "FAQ size is incorrect") + assertEquals("1. This is a question", data.first().first.toString(), "First question does not match") + assertEquals("This is an answer", data.first().second.toString(), "First answer does not match") + assertEquals("2. This is another question", data.last().first.toString(), "Second question does not match") + assertEquals("This is another answer", data.last().second.toString(), "Second answer does not match") + } + + @Test + fun withoutNumbering() { + val data = InstrumentationRegistry.getTargetContext().kauParseFaq(R.xml.test_faq, false) + assertEquals(2, data.size, "FAQ size is incorrect") + assertEquals("This is a question", data.first().first.toString(), "First question does not match") + assertEquals("This is an answer", data.first().second.toString(), "First answer does not match") + assertEquals("This is another question", data.last().first.toString(), "Second question does not match") + assertEquals("This is another answer", data.last().second.toString(), "Second answer does not match") + } + +} \ No newline at end of file -- cgit v1.2.3