当我尝试运行Junit测试(在Kotlin中编写)时,出现以下异常:
java.lang.IllegalArgumentException: Attempted to find dependent attachment for class javax/xml/bind/DatatypeConverter, but could not find a suitable candidate.
我尝试在以下代码中注释/分解某些行,似乎在我调用command()时发生了异常
类IRIssueTests {
class DummyCommand : TypeOnlyCommandData()
private val ledgerServices = MockServices(listOf("com.my.package.name"))
private val ALICE = TestIdentity(CordaX500Name(organisation = "Alice", locality = "TestLand", country = "US"))
@Test
fun mustIncludeIssueCommand() {
val ir = IRState(
UniqueIdentifier(),
mutableListOf(ALICE.party)
)
ledgerServices.ledger {
transaction {
output(IRContract.ID, ir)
command(listOf(ALICE.publicKey), DummyCommand())
fails()
}
transaction {
output(IRContract.ID, ir)
command(listOf(ALICE.publicKey), IRContract.Commands.Issue())
verifies()
}
}
}
}
我想了解为什么会收到此异常以及如何解决该异常以使我的测试通过
答案 0 :(得分:0)
Kotlin测试必须与JDK8一起运行。 在运行测试之前,请在项目中更改JDK8的配置。 这样可以避免这种异常情况