com.r3corda.core.testing

## Package com.r3corda.core.testing

### Types

AlwaysSucceedContract | `class AlwaysSucceedContract : Contract`
DummyLinearState | `class DummyLinearState : LinearState`
EnforceVerifyOrFail | `sealed class EnforceVerifyOrFail` If you jumped here from a compiler error make sure the last line of your test tests for a transaction verify or fail. This is a dummy type that can only be instantiated by functions in this module. This way we can ensure that all tests will have as the last line either an accept or a failure test. The name is deliberately long to help make sense of the triggered diagnostic.
InMemoryWalletService | `open class InMemoryWalletService : SingletonSerializeAsToken, WalletService` This class implements a simple, in memory wallet that tracks states that are owned by us, and also has a convenience method to auto-generate some self-issued cash states that can be used for test trading. A real wallet would persist states relevant to us into a database and once such a wallet is implemented, this scaffolding can be removed.
LedgerDSL | `class LedgerDSL<out T : TransactionDSLInterpreter, out L : LedgerDSLInterpreter<T>> : LedgerDSLInterpreter<TransactionDSLInterpreter>` 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 LedgerDSLInterpreter and then add the convenience defaults/extension methods here.
LedgerDSLInterpreter | `interface LedgerDSLInterpreter<out T : TransactionDSLInterpreter> : Verifies, OutputStateLookup` This interface defines the bare bone functionality that a Ledger DSL interpreter should implement.
OutputStateLookup | `interface OutputStateLookup` This interface defines output state lookup by label. It is split from the interpreter interfaces so that outputs may be looked up both in ledger{..} and transaction{..} blocks.
TestLedgerDSLInterpreter | `data class TestLedgerDSLInterpreter : LedgerDSLInterpreter<TestTransactionDSLInterpreter>`
TestTransactionDSLInterpreter | `data class TestTransactionDSLInterpreter : TransactionDSLInterpreter, OutputStateLookup` This interpreter builds a transaction, and TransactionDSL.verifies that the resolved transaction is correct. Note that transactions corresponding to input states are not verified. Use LedgerDSL.verifies for that.
TransactionDSL | `class TransactionDSL<out T : TransactionDSLInterpreter> : TransactionDSLInterpreter`
TransactionDSLInterpreter | `interface TransactionDSLInterpreter : Verifies, OutputStateLookup` This interface defines the bare bone functionality that a Transaction DSL interpreter should implement.
Verifies | `interface Verifies` This interface asserts that the DSL at hand is capable of verifying its underlying construct(ledger/transaction).

### Exceptions

AttachmentResolutionException | `class AttachmentResolutionException : Exception`
DuplicateOutputLabel | `class DuplicateOutputLabel : Exception`

### Properties

ALICE | `val ALICE: Party`
ALICE_KEY | `val ALICE_KEY: KeyPair`
ALICE_PUBKEY | `val ALICE_PUBKEY: PublicKey`
ALL_TEST_KEYS | `val ALL_TEST_KEYS: List<KeyPair>`
BOB | `val BOB: Party`
BOB_KEY | `val BOB_KEY: KeyPair`
BOB_PUBKEY | `val BOB_PUBKEY: PublicKey`
CHARLIE | `val CHARLIE: Party`
CHARLIE_KEY | `val CHARLIE_KEY: KeyPair`
CHARLIE_PUBKEY | `val CHARLIE_PUBKEY: PublicKey`
DUMMY_KEY_1 | `val DUMMY_KEY_1: KeyPair`
DUMMY_KEY_2 | `val DUMMY_KEY_2: KeyPair`
DUMMY_KEY_3 | `val DUMMY_KEY_3: KeyPair`
DUMMY_NOTARY | `val DUMMY_NOTARY: Party`
DUMMY_NOTARY_KEY | `val DUMMY_NOTARY_KEY: KeyPair`
DUMMY_PUBKEY_1 | `val DUMMY_PUBKEY_1: PublicKey`
DUMMY_PUBKEY_2 | `val DUMMY_PUBKEY_2: PublicKey`
MEGA_CORP | `val MEGA_CORP: Party`
MEGA_CORP_KEY | `val MEGA_CORP_KEY: KeyPair`
MEGA_CORP_PUBKEY | `val MEGA_CORP_PUBKEY: PublicKey`
MINI_CORP | `val MINI_CORP: Party`
MINI_CORP_KEY | `val MINI_CORP_KEY: KeyPair`
MINI_CORP_PUBKEY | `val MINI_CORP_PUBKEY: PublicKey`
MOCK_IDENTITY_SERVICE | `val MOCK_IDENTITY_SERVICE: MockIdentityService`
ORACLE_KEY | `val ORACLE_KEY: KeyPair`
ORACLE_PUBKEY | `val ORACLE_PUBKEY: PublicKey`
TEST_TX_TIME | `val TEST_TX_TIME: Instant`JAVA INTEROP

### Functions

freeLocalHostAndPort | `fun freeLocalHostAndPort(): <ERROR CLASS>`
generateStateRef | `fun generateStateRef(): StateRef`
ledger | `fun ledger(identityService: IdentityService = MOCK_IDENTITY_SERVICE, storageService: StorageService = MockStorageService(), dsl: LedgerDSL<TestTransactionDSLInterpreter, TestLedgerDSLInterpreter>.() -> Unit): LedgerDSL<TestTransactionDSLInterpreter, TestLedgerDSLInterpreter>` Creates and tests a ledger built by the passed in dsl. `fun TransactionDSLInterpreter.ledger(dsl: LedgerDSL<TestTransactionDSLInterpreter, TestLedgerDSLInterpreter>.() -> Unit): Unit` Here follows implementations of the LedgerDSLInterpreter and TransactionDSLInterpreter interfaces to be used in tests. Top level primitives ledger and transaction that bind the interpreter types are also defined here. `fun LedgerDSLInterpreter<TransactionDSLInterpreter>.ledger(dsl: LedgerDSL<TestTransactionDSLInterpreter, TestLedgerDSLInterpreter>.() -> Unit): Unit`
rootCauseExceptions | `fun <R> rootCauseExceptions(body: () -> R): R` If an exception is thrown by the body, rethrows the root cause exception.
signAll | `fun signAll(transactionsToSign: List<WireTransaction>, extraKeys: Array<out KeyPair>): <ERROR CLASS>` Signs all transactions passed in. `fun LedgerDSL<TestTransactionDSLInterpreter, TestLedgerDSLInterpreter>.signAll(vararg extraKeys: KeyPair): <ERROR CLASS>` Signs all transactions in the ledger.
transaction | `fun transaction(transactionLabel: String? = null, transactionBuilder: TransactionBuilder = TransactionBuilder(), dsl: TransactionDSL<TransactionDSLInterpreter>.() -> EnforceVerifyOrFail): LedgerDSL<TestTransactionDSLInterpreter, TestLedgerDSLInterpreter>` Creates a ledger with a single transaction, built by the passed in dsl. `fun TransactionDSLInterpreter.transaction(dsl: TransactionDSL<TransactionDSLInterpreter>.() -> EnforceVerifyOrFail): Unit`