public class LedgerDSL<T extends TransactionDSLInterpreter,L extends LedgerDSLInterpreter<? extends T>> implements LedgerDSLInterpreter<T>
This is the class that defines the syntactic sugar of the ledger Test DSL and delegates to the contained interpreter,
and what is actually used in ledger { (...) }
. Add convenience functions here, or if you want to extend the DSL
functionality then first add your primitive to interface LedgerDSLInterpreter
and then add the convenience defaults/extension
methods here.
interface LedgerDSLInterpreter
Verifies.DefaultImpls
Constructor and Description |
---|
LedgerDSL(L interpreter,
Party notary)
This is the class that defines the syntactic sugar of the ledger Test DSL and delegates to the contained interpreter,
and what is actually used in
ledger { (...) } . Add convenience functions here, or if you want to extend the DSL
functionality then first add your primitive to interface LedgerDSLInterpreter and then add the convenience defaults/extension
methods here. |
Modifier and Type | Method and Description |
---|---|
WireTransaction |
_transaction(java.lang.String transactionLabel,
TransactionBuilder transactionBuilder,
Function1<? super net.corda.testing.dsl.TransactionDSLInterpreter,? extends net.corda.testing.dsl.EnforceVerifyOrFail> dsl)
Creates and adds a transaction to the ledger.
|
void |
_tweak(Function1<? super net.corda.testing.dsl.LedgerDSLInterpreter<? extends net.corda.testing.dsl.TransactionDSLInterpreter>,Unit> dsl)
Creates a local scoped copy of the ledger.
|
WireTransaction |
_unverifiedTransaction(java.lang.String transactionLabel,
TransactionBuilder transactionBuilder,
Function1<? super net.corda.testing.dsl.TransactionDSLInterpreter,Unit> dsl)
Creates and adds a transaction to the ledger that will not be verified by
Verifies.verifies . |
SecureHash |
attachment(java.io.InputStream attachment)
Adds an attachment to the ledger.
|
EnforceVerifyOrFail |
fails()
Asserts that
Verifies.verifies throws, with no condition on the exception message. |
EnforceVerifyOrFail |
fails with(java.lang.String msg) |
EnforceVerifyOrFail |
failsWith(java.lang.String expectedMessage)
Asserts that verifies() throws.
|
L |
getInterpreter() |
<S extends ContractState> |
retrieveOutput(java.lang.Class<S> clazz,
java.lang.String label)
Retrieves an output previously defined by TransactionDSLInterpreter._output with a label passed in.
|
<S extends ContractState> |
retrieveOutputStateAndRef(java.lang.Class<S> clazz,
java.lang.String label)
Retrieves an output previously defined by
TransactionDSLInterpreter.output with a label passed in. |
WireTransaction |
transaction(java.lang.String label,
TransactionBuilder transactionBuilder,
Function1<? super net.corda.testing.dsl.TransactionDSL<? extends net.corda.testing.dsl.TransactionDSLInterpreter>,? extends net.corda.testing.dsl.EnforceVerifyOrFail> dsl)
Creates and adds a transaction to the ledger.
|
void |
tweak(Function1<? super net.corda.testing.dsl.LedgerDSL<? extends T,? extends L>,Unit> dsl)
Creates a local scoped copy of the ledger.
|
WireTransaction |
unverifiedTransaction(java.lang.String label,
TransactionBuilder transactionBuilder,
Function1<? super net.corda.testing.dsl.TransactionDSL<? extends net.corda.testing.dsl.TransactionDSLInterpreter>,Unit> dsl)
Creates and adds a transaction to the ledger that will not be verified by verifies.
|
EnforceVerifyOrFail |
verifies()
Verifies the ledger/transaction, throws if the verification fails.
|
_transaction, _tweak, _unverifiedTransaction, attachment
fails, fails with, failsWith, verifies
retrieveOutputStateAndRef
public LedgerDSL(L interpreter, Party notary)
This is the class that defines the syntactic sugar of the ledger Test DSL and delegates to the contained interpreter,
and what is actually used in ledger { (...) }
. Add convenience functions here, or if you want to extend the DSL
functionality then first add your primitive to interface LedgerDSLInterpreter
and then add the convenience defaults/extension
methods here.
interface LedgerDSLInterpreter
public WireTransaction transaction(java.lang.String label, TransactionBuilder transactionBuilder, Function1<? super net.corda.testing.dsl.TransactionDSL<? extends net.corda.testing.dsl.TransactionDSLInterpreter>,? extends net.corda.testing.dsl.EnforceVerifyOrFail> dsl)
Creates and adds a transaction to the ledger.
public WireTransaction unverifiedTransaction(java.lang.String label, TransactionBuilder transactionBuilder, Function1<? super net.corda.testing.dsl.TransactionDSL<? extends net.corda.testing.dsl.TransactionDSLInterpreter>,Unit> dsl)
Creates and adds a transaction to the ledger that will not be verified by verifies.
public void tweak(Function1<? super net.corda.testing.dsl.LedgerDSL<? extends T,? extends L>,Unit> dsl)
Creates a local scoped copy of the ledger.
public <S extends ContractState> S retrieveOutput(java.lang.Class<S> clazz, java.lang.String label)
Retrieves an output previously defined by TransactionDSLInterpreter._output with a label passed in.
public L getInterpreter()
public WireTransaction _transaction(java.lang.String transactionLabel, TransactionBuilder transactionBuilder, Function1<? super net.corda.testing.dsl.TransactionDSLInterpreter,? extends net.corda.testing.dsl.EnforceVerifyOrFail> dsl)
Creates and adds a transaction to the ledger.
transactionLabel
- Optional label of the transaction, to be used in diagnostic messages.transactionBuilder
- The base transactionBuilder that will be used to build the transaction.dsl
- The dsl that should be interpreted for building the transaction.class WireTransaction
of the built transaction.public void _tweak(Function1<? super net.corda.testing.dsl.LedgerDSLInterpreter<? extends net.corda.testing.dsl.TransactionDSLInterpreter>,Unit> dsl)
Creates a local scoped copy of the ledger.
dsl
- The ledger DSL to be interpreted using the copy.public WireTransaction _unverifiedTransaction(java.lang.String transactionLabel, TransactionBuilder transactionBuilder, Function1<? super net.corda.testing.dsl.TransactionDSLInterpreter,Unit> dsl)
Creates and adds a transaction to the ledger that will not be verified by Verifies.verifies
.
transactionLabel
- Optional label of the transaction, to be used in diagnostic messages.transactionBuilder
- The base transactionBuilder that will be used to build the transaction.dsl
- The dsl that should be interpreted for building the transaction.class WireTransaction
of the built transaction.Verifies.verifies
public SecureHash attachment(java.io.InputStream attachment)
Adds an attachment to the ledger.
attachment
- The InputStream defining the contents of the attachment.class SecureHash
that identifies the attachment, to be used in transactions.public EnforceVerifyOrFail fails()
Asserts that Verifies.verifies
throws, with no condition on the exception message.
Verifies.verifies
public EnforceVerifyOrFail fails with(java.lang.String msg)
Verifies.failsWith
public EnforceVerifyOrFail failsWith(java.lang.String expectedMessage)
Asserts that verifies() throws.
expectedMessage
- An optional string to be searched for in the raised exception.public <S extends ContractState> StateAndRef<S> retrieveOutputStateAndRef(java.lang.Class<S> clazz, java.lang.String label)
Retrieves an output previously defined by TransactionDSLInterpreter.output
with a label passed in.
clazz
- The class object holding the type of the output state expected.label
- The label of the to-be-retrieved output state.class StateAndRef
.TransactionDSLInterpreter.output
public EnforceVerifyOrFail verifies()
Verifies the ledger/transaction, throws if the verification fails.