I am possibly doing something wrong here, but I cannot get gradle to print the actual failed assertion message given the following test:
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
public class TestSimple {
@Test
void failedAssertion() throws Throwable {
assertEquals(0, 1.1);
}
}
running gradle like so:
./gradlew cleanTest test --tests TestSimple.failedAssertion
produces the following result:
> Task :test FAILED
TestSimple > failedAssertion() FAILED
org.opentest4j.AssertionFailedError at TestSimple.java:8
1 test completed, 1 failed
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> There were failing tests. See the report at: file:///Users/my.name/Code/development/project/build/reports/tests/test/index.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
4 actionable tasks: 3 executed, 1 up-to-date
I find this very frustrating as theres about 20 lines of cruft attached to the output here, but not the actual error that matters. If I want to see it, I need to wrap this test in a try/catch and print it myself. Am I doing something dumb here?
here are the relevant bits of my gradle file:
dependencies {
// vertx
compile 'io.vertx:vertx-core:4.2.6'
testCompile 'org.junit.jupiter:junit-jupiter:5.8.2'
testCompile 'io.vertx:vertx-junit5:4.2.6'
}
test {
useJUnitPlatform()
testLogging {
showStandardStreams = true
}
}
./gradlew --version
output:
------------------------------------------------------------
Gradle 5.0
------------------------------------------------------------
Build time: 2018-11-26 11:48:43 UTC
Revision: 7fc6e5abf2fc5fe0824aec8a0f5462664dbcd987
Kotlin DSL: 1.0.4
Kotlin: 1.3.10
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM: 1.8.0_332 (Temurin 25.332-b09)
OS: Mac OS X 10.16 x86_64