Minor: a few misc cleanups

This commit is contained in:
Mike Hearn
2015-11-19 11:56:07 +01:00
parent a4aef06e41
commit 7f13b8ab4a
3 changed files with 11 additions and 15 deletions

View File

@ -164,15 +164,15 @@ fun transaction(body: TransactionForTest.() -> Unit) = TransactionForTest().appl
class TransactionGroupForTest {
open inner class LedgerTransactionForTest : AbstractTransactionForTest() {
private val inputs = ArrayList<ContractStateRef>()
private val inStates = ArrayList<ContractStateRef>()
fun input(label: String) {
inputs.add(labelToRefs[label] ?: throw IllegalArgumentException("Unknown label \"$label\""))
inStates.add(labelToRefs[label] ?: throw IllegalArgumentException("Unknown label \"$label\""))
}
fun toLedgerTransaction(time: Instant): LedgerTransaction {
val wireCmds = commands.map { WireCommand(it.value, it.signers) }
return WireTransaction(inputs, outStates.map { it.state }, wireCmds).toLedgerTransaction(time, TEST_KEYS_TO_CORP_MAP)
return WireTransaction(inStates, outStates.map { it.state }, wireCmds).toLedgerTransaction(time, TEST_KEYS_TO_CORP_MAP)
}
}
@ -200,6 +200,8 @@ class TransactionGroupForTest {
@Deprecated("Does not nest ", level = DeprecationLevel.ERROR)
fun roots(body: Roots.() -> Unit) {}
@Deprecated("Use the vararg form of transaction inside roots", level = DeprecationLevel.ERROR)
fun transaction(time: Instant = TEST_TX_TIME, body: LedgerTransactionForTest.() -> Unit) {}
}
fun roots(body: Roots.() -> Unit) = Roots().apply { body() }