Преглед изворни кода

Added 'instantTaskExecutorRule' to test class

sduduzog пре 7 година
родитељ
комит
69828f043b

+ 7 - 6
app/build.gradle

@@ -48,7 +48,7 @@ dependencies {
     // Arch Components
     implementation 'androidx.core:core-ktx:1.0.0'
     implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
-    implementation 'android.arch.navigation:navigation-fragment:1.0.0-alpha06'
+    implementation 'android.arch.navigation:navigation-fragment:1.0.0-alpha07'
     implementation 'androidx.room:room-runtime:2.1.0-alpha01'
     kapt "androidx.room:room-compiler:2.1.0-alpha01"
     kapt "androidx.lifecycle:lifecycle-compiler:2.0.0"
@@ -58,13 +58,14 @@ dependencies {
 
     // Test libs
     testImplementation 'junit:junit:4.12'
-    testImplementation 'org.mockito:mockito-core:2.7.6'
+    testImplementation 'org.mockito:mockito-core:2.19.0'
     androidTestImplementation 'androidx.room:room-testing:2.1.0-alpha01'
-    androidTestImplementation 'androidx.test:runner:1.1.0-beta02'
-    androidTestImplementation 'androidx.test:rules:1.1.0-beta02'
+    androidTestImplementation 'androidx.test:runner:1.1.0'
+    androidTestImplementation 'androidx.test:rules:1.1.0'
     androidTestImplementation 'androidx.annotation:annotation:1.0.0'
-    androidTestImplementation 'androidx.test:runner:1.1.0-beta02'
-    androidTestImplementation 'androidx.test:rules:1.1.0-beta02'
+    androidTestImplementation 'androidx.test:runner:1.1.0'
+    androidTestImplementation 'androidx.test:rules:1.1.0'
+    androidTestImplementation "androidx.arch.core:core-testing:2.0.0"
     androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
     androidTestImplementation 'com.android.support.test.espresso:espresso-intents:3.0.2'
 }

+ 5 - 0
app/src/androidTest/java/com/sduduzog/slimlauncher/DBTest.kt

@@ -1,5 +1,6 @@
 package com.sduduzog.slimlauncher
 
+import androidx.arch.core.executor.testing.InstantTaskExecutorRule
 import androidx.room.Room
 import androidx.test.InstrumentationRegistry
 import androidx.test.runner.AndroidJUnit4
@@ -14,6 +15,7 @@ import org.junit.runner.RunWith
 
 import org.hamcrest.CoreMatchers.equalTo
 import org.junit.Assert.assertThat
+import org.junit.Rule
 
 @RunWith(AndroidJUnit4::class)
 class DBTest {
@@ -21,6 +23,9 @@ class DBTest {
     private var mAppDao: AppDao? = null
     private var mDb: AppRoomDatabase? = null
 
+    @get:Rule
+    var instantTaskExecutorRule = InstantTaskExecutorRule()
+
     @Before
     fun createDb() {
         val context = InstrumentationRegistry.getTargetContext()

+ 0 - 5
app/src/androidTest/java/com/sduduzog/slimlauncher/SetupFragmentTest.kt

@@ -1,8 +1,6 @@
 package com.sduduzog.slimlauncher
 
 
-import android.view.View
-import android.view.ViewGroup
 import androidx.test.espresso.Espresso.onView
 import androidx.test.espresso.action.ViewActions
 import androidx.test.espresso.action.ViewActions.click
@@ -12,11 +10,8 @@ import androidx.test.espresso.matcher.ViewMatchers.*
 import androidx.test.filters.LargeTest
 import androidx.test.rule.ActivityTestRule
 import androidx.test.runner.AndroidJUnit4
-import org.hamcrest.Description
-import org.hamcrest.Matcher
 import org.hamcrest.Matchers
 import org.hamcrest.Matchers.allOf
-import org.hamcrest.TypeSafeMatcher
 import org.junit.Rule
 import org.junit.Test
 import org.junit.runner.RunWith