aboutsummaryrefslogtreecommitdiff
path: root/core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2018-12-24 00:27:25 -0500
committerGitHub <noreply@github.com>2018-12-24 00:27:25 -0500
commita380adea1052d39f23c9c4d432a9380ce347d6c4 (patch)
treecdbb6835cdc3c04df24af2323341d765f64ab2e3 /core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt
parent98a7f378399546086e23e25514b705e037068058 (diff)
downloadkau-a380adea1052d39f23c9c4d432a9380ce347d6c4.tar.gz
kau-a380adea1052d39f23c9c4d432a9380ce347d6c4.tar.bz2
kau-a380adea1052d39f23c9c4d432a9380ce347d6c4.zip
Migrate to androidx (#178)
* Initial refactor * Remove alpha version usages * Update test code * Add tests for checkbox * Fix invalid card import * Remove more old support content * Update kotlin version * Add back kotterknife with new imports * Update docs * Use bold notice * Add changelog * Remove deprecation for kotterknife * Remove unused dependencies * Update changelog
Diffstat (limited to 'core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt')
-rw-r--r--core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt15
1 files changed, 10 insertions, 5 deletions
diff --git a/core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt b/core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt
index f9ce24b..7a6d2e0 100644
--- a/core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt
+++ b/core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt
@@ -1,8 +1,10 @@
package ca.allanwang.kau.xml
-import android.support.test.InstrumentationRegistry
-import android.support.test.filters.MediumTest
-import android.support.test.runner.AndroidJUnit4
+import android.content.Context
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.MediumTest
+import ca.allanwang.kau.test.R
import org.junit.Test
import org.junit.runner.RunWith
import kotlin.test.assertEquals
@@ -14,9 +16,12 @@ import kotlin.test.assertEquals
@MediumTest
class FaqTest {
+ val context: Context
+ get() = ApplicationProvider.getApplicationContext<Context>()
+
@Test
fun simpleTest() {
- InstrumentationRegistry.getTargetContext().kauParseFaq(R.xml.test_faq) { data ->
+ context.kauParseFaq(R.xml.test_faq) { data ->
assertEquals(2, data.size, "FAQ size is incorrect")
assertEquals("1. This is a question", data.first().question.toString(), "First question does not match")
assertEquals("This is an answer", data.first().answer.toString(), "First answer does not match")
@@ -27,7 +32,7 @@ class FaqTest {
@Test
fun withoutNumbering() {
- InstrumentationRegistry.getTargetContext().kauParseFaq(R.xml.test_faq, false) { data ->
+ context.kauParseFaq(R.xml.test_faq, false) { data ->
assertEquals(2, data.size, "FAQ size is incorrect")
assertEquals("This is a question", data.first().question.toString(), "First question does not match")
assertEquals("This is an answer", data.first().answer.toString(), "First answer does not match")