-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for inherited tests (#288)
* Add new classes for verification of inherited tests (to :core and :runner) * Make instrumentation detect inherited JU5 tests from superclass and interfaces * Gradle 7.5.1 * Changelog
- Loading branch information
1 parent
c3428b4
commit fd6c07f
Showing
12 changed files
with
143 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...ation/core/src/androidTest/java/de/mannodermaus/junit5/inheritance/JavaAbstractClass.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package de.mannodermaus.junit5.inheritance; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
abstract class JavaAbstractClass { | ||
@Test | ||
void javaTest() { | ||
assertNotNull(getJavaFileName()); | ||
} | ||
|
||
abstract String getJavaFileName(); | ||
} |
11 changes: 11 additions & 0 deletions
11
...n/core/src/androidTest/java/de/mannodermaus/junit5/inheritance/JavaAbstractClassTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package de.mannodermaus.junit5.inheritance; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
public class JavaAbstractClassTest extends JavaAbstractClass { | ||
@Nullable | ||
@Override | ||
public String getJavaFileName() { | ||
return "hello world"; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...mentation/core/src/androidTest/java/de/mannodermaus/junit5/inheritance/JavaInterface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package de.mannodermaus.junit5.inheritance; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
interface JavaInterface { | ||
@Test | ||
default void javaTest() { | ||
assert(getJavaValue() > 0L); | ||
} | ||
|
||
long getJavaValue(); | ||
} |
8 changes: 8 additions & 0 deletions
8
...ation/core/src/androidTest/java/de/mannodermaus/junit5/inheritance/JavaInterfaceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package de.mannodermaus.junit5.inheritance; | ||
|
||
public class JavaInterfaceTest implements JavaInterface { | ||
@Override | ||
public long getJavaValue() { | ||
return 4815162342L; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
.../core/src/androidTest/java/de/mannodermaus/junit5/inheritance/JavaMixedInterfaceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package de.mannodermaus.junit5.inheritance; | ||
|
||
public class JavaMixedInterfaceTest implements JavaInterface, KotlinInterface { | ||
@Override | ||
public long getJavaValue() { | ||
return 4815162342L; | ||
} | ||
|
||
@Override | ||
public int getKotlinValue() { | ||
return 10101010; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...on/core/src/androidTest/java/de/mannodermaus/junit5/inheritance/KotlinInheritanceTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package de.mannodermaus.junit5.inheritance | ||
|
||
import org.junit.jupiter.api.Assertions.assertNotNull | ||
import org.junit.jupiter.api.Test | ||
|
||
abstract class KotlinAbstractClass { | ||
@Test | ||
fun kotlinTest() { | ||
assertNotNull(getKotlinFileName()) | ||
} | ||
|
||
abstract fun getKotlinFileName(): String? | ||
} | ||
|
||
interface KotlinInterface { | ||
@Test | ||
fun kotlinTest() { | ||
assert(kotlinValue > 0) | ||
} | ||
|
||
val kotlinValue: Int | ||
} | ||
|
||
class KotlinAbstractClassTest : KotlinAbstractClass() { | ||
override fun getKotlinFileName() = "hello world" | ||
} | ||
|
||
class KotlinInterfaceTest : KotlinInterface { | ||
override val kotlinValue: Int = 1337 | ||
} | ||
|
||
class KotlinMixedInterfaceTest : KotlinInterface, JavaInterface { | ||
override val kotlinValue: Int = 1337 | ||
override fun getJavaValue(): Long = 1234L | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters