CORDA-2366 - Adjust assertions to cater for any ordering of results. (#4455)

This commit is contained in:
josecoll 2018-12-23 16:53:01 +00:00 committed by Shams Asari
parent 6f0bc42098
commit 6f9f6fd870

View File

@ -114,8 +114,12 @@ class CordappConstraintsTests {
printVault(restartedNode, allStates)
assertThat(allStates).hasSize(2)
assertThat(allStates[0].state.constraint).isInstanceOf(HashAttachmentConstraint::class.java)
assertThat(allStates[1].state.constraint).isInstanceOf(SignatureAttachmentConstraint::class.java)
// cannot guarantee database results ordering so check for one or the other.
assertThat(allStates[0].state.constraint).isInstanceOfAny(HashAttachmentConstraint::class.java, SignatureAttachmentConstraint::class.java)
if (allStates[0].state.constraint is HashAttachmentConstraint)
assertThat(allStates[1].state.constraint).isInstanceOf(SignatureAttachmentConstraint::class.java)
else
assertThat(allStates[1].state.constraint).isInstanceOf(HashAttachmentConstraint::class.java)
}
}