1
votes

In my project I have a module that contains Corda flow tests written in Kotlin, and using JUnit. Most of the tests pass, except for the flow tests

My assumption is that this is because Corda flow tests require -ea -javaagent:lib/quasar.jar in the command line...

In my gradle.build file I've added

test {
    jvmArgs "-ea -javaagent:lib/quasar.jar"
}

And then from the command line I'm running ./gradlew test but I get these errors from the flow tests:

java.lang.IllegalStateException

kotlin.UninitializedPropertyAccessException

Further Investigations

Running ./gradlew test --info suggests that the jvm arguments are being ignored altogether:

com.acme.FlowTests > Issuance flow should be signed by the initiator FAILED java.lang.IllegalStateException: Missing the '-javaagent' JVM argument. Make sure you run the tests with the Quasar java agent attached to your JVM. See https://docs.corda.net/troubleshooting.html - 'Fiber classes not instrumented' for more details.

kotlin.UninitializedPropertyAccessException: lateinit property network has not been initialized

1

1 Answers

3
votes

The problem was that I was specifying jvmArgs in the wrong module. Adding the following line to gradle.build of the module that contains the tests fixed the issue:

test.jvmArgs = ["-ea", "-javaagent:../lib/quasar.jar"]