@@ -8,9 +8,9 @@ import org.junit.runners.model.RunnerBuilder
88
99private const val LOG_TAG = " AndroidJUnit5"
1010private val jupiterTestAnnotations = listOf (
11- org.junit.jupiter.api.Test :: class .java ,
12- org.junit.jupiter.api.TestFactory :: class .java ,
13- org.junit.jupiter.params.ParameterizedTest :: class .java )
11+ " org.junit.jupiter.api.Test" ,
12+ " org.junit.jupiter.api.TestFactory" ,
13+ " org.junit.jupiter.params.ParameterizedTest" )
1414
1515/* Types */
1616
@@ -34,7 +34,6 @@ class AndroidJUnit5Builder : RunnerBuilder() {
3434 private val junit5Available by lazy {
3535 try {
3636 Class .forName(" org.junit.jupiter.api.Test" )
37- Class .forName(" org.junit.jupiter.params.ParameterizedTest" )
3837 Class .forName(" de.mannodermaus.junit5.AndroidJUnit5" )
3938 true
4039 } catch (e: Throwable ) {
@@ -52,7 +51,6 @@ class AndroidJUnit5Builder : RunnerBuilder() {
5251 if (! testClass.hasJupiterTestMethods()) {
5352 return null
5453 }
55-
5654 return createJUnit5Runner(testClass)
5755
5856 } catch (e: NoClassDefFoundError ) {
@@ -74,12 +72,14 @@ class AndroidJUnit5Builder : RunnerBuilder() {
7472 // Check each method in the Class for the presence
7573 // of the well-known list of JUnit Jupiter annotations
7674 val testMethod = declaredMethods.firstOrNull { method ->
75+ val annotationClassNames = method.declaredAnnotations.map { it.annotationClass.qualifiedName }
7776 jupiterTestAnnotations.firstOrNull { annotation ->
78- method.isAnnotationPresent (annotation)
77+ annotationClassNames.contains (annotation)
7978 } != null
8079 }
8180
8281 if (testMethod != null ) {
82+ Log .i(LOG_TAG , " Jupiter Test Class detected: ${this .name} " )
8383 return true
8484 }
8585
@@ -91,7 +91,7 @@ class AndroidJUnit5Builder : RunnerBuilder() {
9191 }
9292
9393 } catch (t: Throwable ) {
94- Log .w(LOG_TAG , " $t in hasTestMethods for $name " )
94+ Log .w(LOG_TAG , " ${t.javaClass.name} in 'hasJupiterTestMethods()' for $name " , t )
9595 }
9696
9797 return false
0 commit comments