com.r3corda.core.testing

Package com.r3corda.core.testing

Types

AbstractTransactionForTest abstract class AbstractTransactionForTest
AlwaysSucceedContract class AlwaysSucceedContract : Contract
DummyLinearState class DummyLinearState : LinearState
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.

JavaTestHelpers object JavaTestHelpers

JAVA INTEROP. Please keep the following points in mind when extending the Kotlin DSL

LabeledOutput class LabeledOutput
LastLineShouldTestForAcceptOrFailure sealed class LastLineShouldTestForAcceptOrFailure

If you jumped here from a compiler error make sure the last line of your test tests for a transaction accept 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

TestUtils object TestUtils
TransactionForTest open class TransactionForTest : AbstractTransactionForTest
TransactionGroupDSL class TransactionGroupDSL<T : ContractState>

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
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

Functions

freeLocalHostAndPort fun freeLocalHostAndPort(): <ERROR CLASS>
generateStateRef fun generateStateRef(): StateRef
label infix fun TransactionState<*>.label(label: String): LabeledOutput
rootCauseExceptions fun <R> rootCauseExceptions(body: () -> R): R

If an exception is thrown by the body, rethrows the root cause exception.

transaction fun transaction(body: TransactionForTest.() -> LastLineShouldTestForAcceptOrFailure): LastLineShouldTestForAcceptOrFailure
transactionGroup fun transactionGroup(body: TransactionGroupDSL<ContractState>.() -> Unit): <ERROR CLASS>
transactionGroupFor fun <T : ContractState> transactionGroupFor(body: TransactionGroupDSL<T>.() -> Unit): <ERROR CLASS>