mirror of
https://github.com/corda/corda.git
synced 2025-06-14 13:18:18 +00:00
ENT-2320 Introduce annotation to link state classes and contract classes (#1336)
* Introduce and check @BelongsToContract annotation * Fix broken ObligationTests * TransactionContractConflictException inherits from TransactionVerificationException * Really fix broken ObligationTests * Convert fun to val * Update kdoc on BelongsToContract, simplify contract checking * Warn in TransactionBuilder if ContractState has no owning contract * Fix failing tests * Unseal TransactionVerificationException * Make contract parameter of TransactionState optional * Replace exception with a warning for now * Update api-current to permit @BelongsToContract annotation to be added * cosmetic tweaks * Throw IllegalArgumentException, not NPE * Throw IllegalArgumentException, not NPE
This commit is contained in:
@ -260,7 +260,7 @@ public class CommercialPaperTest {
|
||||
|
||||
// Some CP is issued onto the ledger by MegaCorp.
|
||||
l.transaction("Issuance", tx -> {
|
||||
tx.output(Cash.PROGRAM_ID, "paper", getPaper());
|
||||
tx.output(JCP_PROGRAM_ID, "paper", getPaper());
|
||||
tx.command(megaCorp.getPublicKey(), new JavaCommercialPaper.Commands.Issue());
|
||||
tx.attachments(JCP_PROGRAM_ID);
|
||||
tx.timeWindow(TEST_TX_TIME);
|
||||
@ -306,7 +306,7 @@ public class CommercialPaperTest {
|
||||
|
||||
// Some CP is issued onto the ledger by MegaCorp.
|
||||
l.transaction("Issuance", tx -> {
|
||||
tx.output(Cash.PROGRAM_ID, "paper", getPaper());
|
||||
tx.output(JCP_PROGRAM_ID, "paper", getPaper());
|
||||
tx.command(megaCorp.getPublicKey(), new JavaCommercialPaper.Commands.Issue());
|
||||
tx.attachments(JCP_PROGRAM_ID);
|
||||
tx.timeWindow(TEST_TX_TIME);
|
||||
@ -319,7 +319,7 @@ public class CommercialPaperTest {
|
||||
tx.output(Cash.PROGRAM_ID, "borrowed $900", new Cash.State(issuedBy(DOLLARS(900), issuer), megaCorp.getParty()));
|
||||
JavaCommercialPaper.State inputPaper = l.retrieveOutput(JavaCommercialPaper.State.class, "paper");
|
||||
tx.output(JCP_PROGRAM_ID, "alice's paper", inputPaper.withOwner(alice.getParty()));
|
||||
tx.command(alice.getPublicKey(), new Cash.Commands.Move());
|
||||
tx.command(alice.getPublicKey(), new Cash.Commands.Move(JavaCommercialPaper.class));
|
||||
tx.command(megaCorp.getPublicKey(), new JavaCommercialPaper.Commands.Move());
|
||||
return tx.verifies();
|
||||
});
|
||||
|
@ -305,7 +305,7 @@ class CommercialPaperTest {
|
||||
input("alice's $900")
|
||||
output(Cash.PROGRAM_ID, "borrowed $900", 900.DOLLARS.CASH issuedBy issuer ownedBy megaCorp.party)
|
||||
output(CP_PROGRAM_ID, "alice's paper", "paper".output<ICommercialPaperState>().withOwner(alice.party))
|
||||
command(alice.publicKey, Cash.Commands.Move())
|
||||
command(alice.publicKey, Cash.Commands.Move(CommercialPaper::class.java))
|
||||
command(megaCorp.publicKey, CommercialPaper.Commands.Move())
|
||||
verifies()
|
||||
}
|
||||
|
Reference in New Issue
Block a user