fix compatibility issue with Java8 and unit tests
ruleant opened this issue · 5 comments
junit4 is not compatible with Java 8 :
com.github.ruleant.getback_gps.lib.LatitudeTest > testGetSegment FAILED
java.lang.IllegalArgumentException
- enable junit5 in gradle build (including de.mannodermaus.gradle.plugins:android-junit5:1.7.0.0)
- convert tests to junit5
- fix tests using mockito
- enable coverage (replacement for cobertura?), see #126
Temporarily disabled unittest in Gradle file:
Gradle now uses separate output directories for each JVM language, but this build assumes a single directory for all classes from a source set. This behaviour has been deprecated and is scheduled to be removed in Gradle 5.0 at build_47v1op87c5rii96bt2k4tdgku$_run_closure8.doCall(/vagrant/build.gradle:90) (Run with --stacktrace to get the full stack trace of this deprecation warning.) The setTestClassesDir(File) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the setTestClassesDirs(FileCollection) method instead. at build_47v1op87c5rii96bt2k4tdgku$_run_closure8.doCall(/vagrant/build.gradle:90)
Particularly problems with :
testClassesDir = project.sourceSets.unitTest.output.classesDir classpath = project.sourceSets.unitTest.runtimeClasspath
- https://howtodoinjava.com/junit5/expected-exception-example/
- https://github.com/junit-team/junit5-samples/tree/r5.7.0/junit5-jupiter-starter-gradle
- https://github.com/mannodermaus/android-junit5/blob/main/instrumentation/sample/src/test/java/de/mannodermaus/sample/ExampleJavaTest.java
- https://www.lordcodes.com/articles/testing-on-android-using-junit-5
preparation in junit5 branch
testresultaat in build/reports/tests/testReleaseUnitTest/index.html
run unit tests with ./gradlew clean check