From 3f28748f959dedb6f7baee7c1c27e343080e8c3f Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sat, 27 Jun 2020 14:36:40 -0700 Subject: Update AS and add hilt version info --- .../kotlin/ca/allanwang/kau/sample/BaseTest.kt | 17 ----------------- .../kotlin/ca/allanwang/kau/sample/KPrefViewTest.kt | 1 + .../kotlin/ca/allanwang/kau/sample/TestModules.kt | 15 --------------- .../kotlin/ca/allanwang/kau/sample/test/BaseTest.kt | 17 +++++++++++++++++ .../kotlin/ca/allanwang/kau/sample/test/TestModules.kt | 15 +++++++++++++++ 5 files changed, 33 insertions(+), 32 deletions(-) delete mode 100644 sample/src/androidTest/kotlin/ca/allanwang/kau/sample/BaseTest.kt delete mode 100644 sample/src/androidTest/kotlin/ca/allanwang/kau/sample/TestModules.kt create mode 100644 sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/BaseTest.kt create mode 100644 sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/TestModules.kt (limited to 'sample/src/androidTest') diff --git a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/BaseTest.kt b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/BaseTest.kt deleted file mode 100644 index 0f19b05..0000000 --- a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/BaseTest.kt +++ /dev/null @@ -1,17 +0,0 @@ -package ca.allanwang.kau.sample - -import dagger.hilt.android.testing.HiltAndroidRule -import org.junit.Rule -import kotlin.test.BeforeTest - -abstract class BaseTest { - @Suppress("LeakingThis") - @get:Rule - val hiltRule: HiltAndroidRule = - HiltAndroidRule(this) - - @BeforeTest - fun before() { - hiltRule.inject() - } -} \ No newline at end of file diff --git a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/KPrefViewTest.kt b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/KPrefViewTest.kt index a8475b3..bfdcfff 100644 --- a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/KPrefViewTest.kt +++ b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/KPrefViewTest.kt @@ -26,6 +26,7 @@ import androidx.test.espresso.matcher.ViewMatchers.withChild import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.rule.ActivityTestRule +import ca.allanwang.kau.sample.test.BaseTest import dagger.hilt.android.testing.HiltAndroidTest import dagger.hilt.android.testing.UninstallModules import kotlin.test.assertFalse diff --git a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/TestModules.kt b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/TestModules.kt deleted file mode 100644 index 061af50..0000000 --- a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/TestModules.kt +++ /dev/null @@ -1,15 +0,0 @@ -package ca.allanwang.kau.sample - -import ca.allanwang.kau.kpref.KPrefFactory -import ca.allanwang.kau.kpref.KPrefFactoryInMemory -import dagger.Module -import dagger.Provides -import dagger.hilt.InstallIn -import dagger.hilt.android.components.ApplicationComponent - -@Module -@InstallIn(ApplicationComponent::class) -object PrefFactoryTestModule { - @Provides - fun factory(): KPrefFactory = KPrefFactoryInMemory -} \ No newline at end of file diff --git a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/BaseTest.kt b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/BaseTest.kt new file mode 100644 index 0000000..c3a17ea --- /dev/null +++ b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/BaseTest.kt @@ -0,0 +1,17 @@ +package ca.allanwang.kau.sample.test + +import dagger.hilt.android.testing.HiltAndroidRule +import org.junit.Rule +import kotlin.test.BeforeTest + +abstract class BaseTest { + @Suppress("LeakingThis") + @get:Rule + val hiltRule: HiltAndroidRule = + HiltAndroidRule(this) + + @BeforeTest + fun before() { + hiltRule.inject() + } +} \ No newline at end of file diff --git a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/TestModules.kt b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/TestModules.kt new file mode 100644 index 0000000..4e49810 --- /dev/null +++ b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/TestModules.kt @@ -0,0 +1,15 @@ +package ca.allanwang.kau.sample.test + +import ca.allanwang.kau.kpref.KPrefFactory +import ca.allanwang.kau.kpref.KPrefFactoryInMemory +import dagger.Module +import dagger.Provides +import dagger.hilt.InstallIn +import dagger.hilt.android.components.ApplicationComponent + +@Module +@InstallIn(ApplicationComponent::class) +object PrefFactoryTestModule { + @Provides + fun factory(): KPrefFactory = KPrefFactoryInMemory +} \ No newline at end of file -- cgit v1.2.3