aboutsummaryrefslogtreecommitdiff
path: root/core/src/androidTest/kotlin/ca/allanwang
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
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')
-rw-r--r--core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt9
-rw-r--r--core/src/androidTest/kotlin/ca/allanwang/kau/utils/KotterknifeTest.kt8
-rw-r--r--core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt15
3 files changed, 19 insertions, 13 deletions
diff --git a/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt b/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt
index 2a9263a..52f344b 100644
--- a/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt
+++ b/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt
@@ -1,9 +1,10 @@
package ca.allanwang.kau.kpref
import android.annotation.SuppressLint
-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 org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@@ -23,7 +24,7 @@ class KPrefTest {
class TestPref : KPref() {
init {
- initialize(InstrumentationRegistry.getTargetContext(), "kpref_test_${System.currentTimeMillis()}")
+ initialize(ApplicationProvider.getApplicationContext<Context>(), "kpref_test_${System.currentTimeMillis()}")
}
var one by kpref("one", 1)
diff --git a/core/src/androidTest/kotlin/ca/allanwang/kau/utils/KotterknifeTest.kt b/core/src/androidTest/kotlin/ca/allanwang/kau/utils/KotterknifeTest.kt
index 1dac92f..13a3c77 100644
--- a/core/src/androidTest/kotlin/ca/allanwang/kau/utils/KotterknifeTest.kt
+++ b/core/src/androidTest/kotlin/ca/allanwang/kau/utils/KotterknifeTest.kt
@@ -1,12 +1,12 @@
package ca.allanwang.kau.utils
import android.content.Context
-import android.support.test.InstrumentationRegistry
-import android.support.test.filters.MediumTest
-import android.support.test.runner.AndroidJUnit4
import android.view.View
import android.widget.FrameLayout
import android.widget.TextView
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.MediumTest
+import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@@ -25,7 +25,7 @@ class KotterknifeTest {
@Before
fun init() {
- context = InstrumentationRegistry.getContext()
+ context = InstrumentationRegistry.getInstrumentation().context
}
@Test
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")