PR#32 Fix lint issues, remove Jake's IdlingResources, since it won't be updated anymore
This commit is contained in:
parent
5fe8def390
commit
ef14673a32
7 changed files with 60 additions and 12 deletions
|
|
@ -7,13 +7,12 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 31
|
compileSdk 31
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "org.fnives.test.showcase"
|
applicationId "org.fnives.test.showcase"
|
||||||
minSdkVersion 21
|
minSdk 21
|
||||||
//OldTargetApi
|
targetSdk 31
|
||||||
targetSdkVersion 31
|
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
buildConfigField "String", "BASE_URL", '"https://606844a10add49001733fe6b.mockapi.io/"'
|
buildConfigField "String", "BASE_URL", '"https://606844a10add49001733fe6b.mockapi.io/"'
|
||||||
|
|
@ -139,7 +138,6 @@ dependencies {
|
||||||
testImplementation "androidx.test.espresso:espresso-core:$testing_espresso_version"
|
testImplementation "androidx.test.espresso:espresso-core:$testing_espresso_version"
|
||||||
testImplementation "androidx.test.espresso:espresso-intents:$testing_espresso_version"
|
testImplementation "androidx.test.espresso:espresso-intents:$testing_espresso_version"
|
||||||
testImplementation project(':mockserver')
|
testImplementation project(':mockserver')
|
||||||
testImplementation "com.jakewharton.espresso:okhttp3-idling-resource:$testing_okhttp3_idling_resource_version"
|
|
||||||
testImplementation "androidx.arch.core:core-testing:$testing_androidx_arch_core_version"
|
testImplementation "androidx.arch.core:core-testing:$testing_androidx_arch_core_version"
|
||||||
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$testing_junit5_version"
|
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$testing_junit5_version"
|
||||||
testImplementation "com.google.dagger:hilt-android-testing:$hilt_version"
|
testImplementation "com.google.dagger:hilt-android-testing:$hilt_version"
|
||||||
|
|
@ -154,7 +152,6 @@ dependencies {
|
||||||
androidTestImplementation "androidx.test.espresso:espresso-core:$testing_espresso_version"
|
androidTestImplementation "androidx.test.espresso:espresso-core:$testing_espresso_version"
|
||||||
androidTestImplementation "androidx.test.espresso:espresso-intents:$testing_espresso_version"
|
androidTestImplementation "androidx.test.espresso:espresso-intents:$testing_espresso_version"
|
||||||
androidTestImplementation project(':mockserver')
|
androidTestImplementation project(':mockserver')
|
||||||
androidTestImplementation "com.jakewharton.espresso:okhttp3-idling-resource:$testing_okhttp3_idling_resource_version"
|
|
||||||
androidTestImplementation "androidx.arch.core:core-testing:$testing_androidx_arch_core_version"
|
androidTestImplementation "androidx.arch.core:core-testing:$testing_androidx_arch_core_version"
|
||||||
androidTestRuntimeOnly "org.junit.vintage:junit-vintage-engine:$testing_junit5_version"
|
androidTestRuntimeOnly "org.junit.vintage:junit-vintage-engine:$testing_junit5_version"
|
||||||
androidTestImplementation "com.google.dagger:hilt-android-testing:$hilt_version"
|
androidTestImplementation "com.google.dagger:hilt-android-testing:$hilt_version"
|
||||||
|
|
@ -162,4 +159,12 @@ dependencies {
|
||||||
androidTestImplementation project(":network") // hilt needs it
|
androidTestImplementation project(":network") // hilt needs it
|
||||||
|
|
||||||
implementation "io.reactivex.rxjava3:rxjava:3.1.2"
|
implementation "io.reactivex.rxjava3:rxjava:3.1.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///Users/gergelyhegedus/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.5.31/ff5d99aecd328872494e8921b72bf6e3af97af3e/kotlin-stdlib-jdk8-1.5.31.jar (version 1.5)
|
||||||
|
///Users/gergelyhegedus/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.5.31/77e0f2568912e45d26c31fd417a332458508acdf/kotlin-stdlib-jdk7-1.5.31.jar (version 1.5)
|
||||||
|
///Users/gergelyhegedus/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.6.0/a40b8b22529b733892edf4b73468ce598bb17f04/kotlin-stdlib-1.6.0.jar (version 1.6)
|
||||||
|
///Users/gergelyhegedus/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.6.0/7857e365f925cfa060f941c1357cda1f8790502c/kotlin-stdlib-common-1.6.0.jar (version 1.6)
|
||||||
|
//w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
|
||||||
|
//dagger.lint.DaggerIssueRegistry in /Users/gergelyhegedus/.gradle/caches/transforms-3/7d8d9a87fed97b25e3e147795231ede4/transformed/jetified-dagger-lint-aar-2.40/jars/lint.jar does not specify a vendor; see IssueRegistry#vendor
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
package org.fnives.test.showcase.testutils.idling
|
||||||
|
|
||||||
|
import androidx.annotation.CheckResult
|
||||||
|
import androidx.annotation.NonNull
|
||||||
|
import androidx.test.espresso.IdlingResource
|
||||||
|
import okhttp3.Dispatcher
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AndroidX version of Jake Wharton's OkHttp3IdlingResource.
|
||||||
|
*
|
||||||
|
* Reference: https://github.com/JakeWharton/okhttp-idling-resource/blob/master/src/main/java/com/jakewharton/espresso/OkHttp3IdlingResource.java
|
||||||
|
*/
|
||||||
|
class OkHttp3IdlingResource private constructor(
|
||||||
|
private val name: String,
|
||||||
|
private val dispatcher: Dispatcher
|
||||||
|
) : IdlingResource {
|
||||||
|
@Volatile
|
||||||
|
var callback: IdlingResource.ResourceCallback? = null
|
||||||
|
|
||||||
|
init {
|
||||||
|
dispatcher.idleCallback = Runnable { callback?.onTransitionToIdle() }
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getName(): String = name
|
||||||
|
|
||||||
|
override fun isIdleNow(): Boolean = dispatcher.runningCallsCount() == 0
|
||||||
|
|
||||||
|
override fun registerIdleTransitionCallback(callback: IdlingResource.ResourceCallback?) {
|
||||||
|
this.callback = callback
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
/**
|
||||||
|
* Create a new [IdlingResource] from `client` as `name`. You must register
|
||||||
|
* this instance using `Espresso.registerIdlingResources`.
|
||||||
|
*/
|
||||||
|
@CheckResult
|
||||||
|
@NonNull // Extra guards as a library.
|
||||||
|
fun create(@NonNull name: String?, @NonNull client: OkHttpClient?): OkHttp3IdlingResource {
|
||||||
|
if (name == null) throw NullPointerException("name == null")
|
||||||
|
if (client == null) throw NullPointerException("client == null")
|
||||||
|
return OkHttp3IdlingResource(name, client.dispatcher)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,6 @@ package org.fnives.test.showcase.testutils.idling
|
||||||
|
|
||||||
import androidx.annotation.CheckResult
|
import androidx.annotation.CheckResult
|
||||||
import androidx.test.espresso.IdlingResource
|
import androidx.test.espresso.IdlingResource
|
||||||
import com.jakewharton.espresso.OkHttp3IdlingResource
|
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import org.fnives.test.showcase.hilt.SessionLessQualifier
|
import org.fnives.test.showcase.hilt.SessionLessQualifier
|
||||||
import org.fnives.test.showcase.hilt.SessionQualifier
|
import org.fnives.test.showcase.hilt.SessionQualifier
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package org.fnives.test.showcase.testutils.idling
|
||||||
|
|
||||||
import androidx.annotation.CheckResult
|
import androidx.annotation.CheckResult
|
||||||
import androidx.test.espresso.IdlingResource
|
import androidx.test.espresso.IdlingResource
|
||||||
import com.jakewharton.espresso.OkHttp3IdlingResource
|
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import org.koin.core.qualifier.StringQualifier
|
import org.koin.core.qualifier.StringQualifier
|
||||||
import org.koin.test.KoinTest
|
import org.koin.test.KoinTest
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
|
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
|
||||||
classpath 'com.android.tools.build:gradle:7.0.3'
|
classpath 'com.android.tools.build:gradle:7.0.4'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
classpath "org.jlleitschuh.gradle:ktlint-gradle:10.2.0"
|
classpath "org.jlleitschuh.gradle:ktlint-gradle:10.2.0"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
# Automatically convert third-party libraries to use AndroidX
|
# Automatically convert third-party libraries to use AndroidX
|
||||||
android.enableJetifier=true
|
android.enableJetifier=false
|
||||||
android.jetifier.ignorelist=bcprov-jdk15on
|
android.jetifier.ignorelist=bcprov-jdk15on
|
||||||
# Kotlin code style for this project: "official" or "obsolete":
|
# Kotlin code style for this project: "official" or "obsolete":
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
|
|
@ -26,5 +26,4 @@ project.ext {
|
||||||
testing_junit4_version = "4.13.2"
|
testing_junit4_version = "4.13.2"
|
||||||
testing_robolectric_version = "4.6.1"
|
testing_robolectric_version = "4.6.1"
|
||||||
testing_espresso_version = "3.4.0"
|
testing_espresso_version = "3.4.0"
|
||||||
testing_okhttp3_idling_resource_version = "1.0.0"
|
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue