1

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

4

1 回答 1

3

问题是我jvmArgs在错误的模块中指定。gradle.build在包含测试的模块中添加以下行可以解决问题:

test.jvmArgs = ["-ea", "-javaagent:../lib/quasar.jar"]
于 2018-06-15T12:40:08.513 回答