Created
June 4, 2024 06:54
-
-
Save parisyup/9cff6f683f9159ae560e2347ee82313f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Suspendable | |
private String testOnlyTwoParticipants(MemberInfo myInfo, MemberInfo otherMember, NotaryInfo notary) { | |
try { | |
IOUState iouState = new IOUState( | |
10, | |
myInfo.getName(), | |
otherMember.getName(), | |
3, | |
UUID.randomUUID(), | |
Collections.singletonList(myInfo.getLedgerKeys().get(0)) | |
); | |
var txBuilder = ledgerService.createTransactionBuilder() | |
.setNotary(notary.getName()) | |
.setTimeWindowBetween(Instant.now(), Instant.now().plusMillis(Duration.ofDays(1).toMillis())) | |
.addOutputState(iouState) | |
.addCommand(new IOUContract.Issue()) | |
.addSignatories(iouState.getParticipants()); | |
var signedTransaction = txBuilder.toSignedTransaction(); | |
return "Fail"; | |
} catch (Exception e) { | |
String exceptionMessage = e.getMessage() != null ? e.getMessage() : "No exception message"; | |
if (exceptionMessage.contains("only two participants")) { | |
return "Pass"; | |
} else { | |
return "Contract failed but with a different Exception: " + e.getMessage(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment