Spring boot 如何单元测试服务&;Cordapp中的控制器(kotlin)?
为了在CordaApp中获得单元测试服务和控制器的示例,我已经阅读了许多文档,而不是流程(在corda文档中已经使用了流程)。有谁能帮我找到一个实施服务单元测试的示例CordaApp吗?试着看看github上的CordaService Autopayroll示例 链接: 在测试代码中可以访问注册的服务Spring boot 如何单元测试服务&;Cordapp中的控制器(kotlin)?,spring-boot,unit-testing,kotlin,controller,corda,Spring Boot,Unit Testing,Kotlin,Controller,Corda,为了在CordaApp中获得单元测试服务和控制器的示例,我已经阅读了许多文档,而不是流程(在corda文档中已经使用了流程)。有谁能帮我找到一个实施服务单元测试的示例CordaApp吗?试着看看github上的CordaService Autopayroll示例 链接: 在测试代码中可以访问注册的服务 //Test #1 check if the requestState is being sent to the bank operator behind the scene. @Test fun
//Test #1 check if the requestState is being sent to the bank operator behind the scene.
@Test
fun `dummy test`() {
val future = a.startFlow(RequestFlowInitiator("500", b.info.legalIdentities.first()))
network.runNetwork()
val ptx = future.get()
println("Signed transaction hash: ${ptx.id}")
listOf(a, bank).map {
it.services.validatedTransactions.getTransaction(ptx.id)
}.forEach {
val txHash = (it as SignedTransaction).id
println("$txHash == ${ptx.id}")
assertEquals(ptx.id, txHash)
}
}
链接:
祝你好运 我们可以使用Mockito模块进行单元测试服务功能和API所需的模拟和刺穿
谢谢@davidawad。但我也需要模拟代理。因为我还需要从api服务文件进行测试。你能分享任何模仿代理的项目吗?