![](/img/trans.png)
[英]Why is my assertion that the element contains a certain String failing even though it is there?
[英]Why are my flow tests failing to check the transaction in certain nodes even if they are present on their storages?
错误:java.lang.AssertionError:预期:net.corda.core.transactions.SignedTransaction,但是:net.corda.core.transactions.SignedTransaction预期:net.corda.core.transactions.SignedTransaction实际:net.corda.core。 transactions.SignedTransaction
据我所知,预期交易和实际交易都是相同的,但仍然会引发错误。 它正在通过其他测试,但是突然失败,并且没有任何令人满意的信息来调试。 以下是我测试中的代码:
@Test
public void flowRecordsATransactionInBothPartiesTransactionStorages() throws Exception {
SignedTransaction signedTx = createPlacementCompleteTxn();
// We check the recorded transaction in both vaults.
for (StartedMockNode node : ImmutableList.of(participantsNodes.get(0), participantsNodes.get(1), participantsNodes.get(3))) {
assertEquals(signedTx, node.getServices().getValidatedTransactions().getTransaction(signedTx.getId()));
}
这对我在Corda 4上工作正常。例如,以下测试通过:
@Test
public void recordedTransactionIsCorrect() throws Exception {
ExampleFlow.Initiator flow = new ExampleFlow.Initiator(1, b.getInfo().getLegalIdentities().get(0));
CordaFuture<SignedTransaction> future = a.startFlow(flow);
network.runNetwork();
SignedTransaction signedTx = future.get();
// We check the recorded transaction in both vaults.
for (StartedMockNode node : ImmutableList.of(a, b)) {
SignedTransaction recordedTx = node.getServices().getValidatedTransactions().getTransaction(signedTx.getId());
assertEquals(recordedTx, signedTx);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.