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
public LedgerDSL(@NotNull L interpreter, @NotNull 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
@JvmOverloads @NotNull public WireTransaction transaction(@Nullable java.lang.String label, @NotNull TransactionBuilder transactionBuilder, @NotNull kotlin.jvm.functions.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.
@JvmOverloads @NotNull public WireTransaction transaction(@Nullable java.lang.String label, @NotNull kotlin.jvm.functions.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.
@JvmOverloads @NotNull public WireTransaction transaction(@NotNull kotlin.jvm.functions.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.
@JvmOverloads @NotNull public WireTransaction unverifiedTransaction(@Nullable java.lang.String label, @NotNull TransactionBuilder transactionBuilder, @NotNull kotlin.jvm.functions.Function1<? super net.corda.testing.dsl.TransactionDSL<? extends net.corda.testing.dsl.TransactionDSLInterpreter>,kotlin.Unit> dsl)
Creates and adds a transaction to the ledger that will not be verified by verifies.
@JvmOverloads @NotNull public WireTransaction unverifiedTransaction(@Nullable java.lang.String label, @NotNull kotlin.jvm.functions.Function1<? super net.corda.testing.dsl.TransactionDSL<? extends net.corda.testing.dsl.TransactionDSLInterpreter>,kotlin.Unit> dsl)
Creates and adds a transaction to the ledger that will not be verified by verifies.
@JvmOverloads @NotNull public WireTransaction unverifiedTransaction(@NotNull kotlin.jvm.functions.Function1<? super net.corda.testing.dsl.TransactionDSL<? extends net.corda.testing.dsl.TransactionDSLInterpreter>,kotlin.Unit> dsl)
Creates and adds a transaction to the ledger that will not be verified by verifies.
public void tweak(@NotNull kotlin.jvm.functions.Function1<? super net.corda.testing.dsl.LedgerDSL<? extends T,? extends L>,kotlin.Unit> dsl)
Creates a local scoped copy of the ledger.
@NotNull public <S extends ContractState> S retrieveOutput(@NotNull java.lang.Class<S> clazz, @NotNull java.lang.String label)
Retrieves an output previously defined by TransactionDSLInterpreter._output with a label passed in.
@NotNull public L getInterpreter()
@NotNull public WireTransaction _transaction(@Nullable java.lang.String transactionLabel, @NotNull TransactionBuilder transactionBuilder, @NotNull kotlin.jvm.functions.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(@NotNull kotlin.jvm.functions.Function1<? super net.corda.testing.dsl.LedgerDSLInterpreter<? extends net.corda.testing.dsl.TransactionDSLInterpreter>,kotlin.Unit> dsl)
Creates a local scoped copy of the ledger.
dsl
- The ledger DSL to be interpreted using the copy.@NotNull public WireTransaction _unverifiedTransaction(@Nullable java.lang.String transactionLabel, @NotNull TransactionBuilder transactionBuilder, @NotNull kotlin.jvm.functions.Function1<? super net.corda.testing.dsl.TransactionDSLInterpreter,kotlin.Unit> dsl)
Creates and adds a transaction to the ledger that will not be verified by 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
@NotNull public SecureHash attachment(@NotNull 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.@NotNull public EnforceVerifyOrFail fails()
Asserts that verifies
throws, with no condition on the exception message.
verifies
@NotNull public EnforceVerifyOrFail fails with(@NotNull java.lang.String msg)
failsWith
@NotNull public EnforceVerifyOrFail failsWith(@Nullable java.lang.String expectedMessage)
Asserts that verifies() throws.
expectedMessage
- An optional string to be searched for in the raised exception.@NotNull public <S extends ContractState> StateAndRef<S> retrieveOutputStateAndRef(@NotNull java.lang.Class<S> clazz, @NotNull 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
@NotNull public EnforceVerifyOrFail verifies()
Verifies the ledger/transaction, throws if the verification fails.