mirror of
https://github.com/corda/corda.git
synced 2024-12-19 21:17:58 +00:00
TestUtils: add some formatting toString methods to make test failures easier to read.
This commit is contained in:
parent
0c6c2df483
commit
e012d2c2f5
@ -7,6 +7,7 @@ class DummyPublicKey(private val s: String) : PublicKey, Comparable<PublicKey> {
|
||||
override fun getEncoded() = s.toByteArray()
|
||||
override fun getFormat() = "ASN.1"
|
||||
override fun compareTo(other: PublicKey): Int = BigInteger(encoded).compareTo(BigInteger(other.encoded))
|
||||
override fun toString() = "PUBKEY[$s]"
|
||||
}
|
||||
|
||||
// A few dummy values for testing.
|
||||
@ -81,6 +82,14 @@ data class TransactionForTest(
|
||||
tx.body()
|
||||
return tx
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return """transaction {
|
||||
inputs: $inStates
|
||||
outputs: $outStates
|
||||
args: $args
|
||||
}"""
|
||||
}
|
||||
}
|
||||
|
||||
fun transaction(body: TransactionForTest.() -> Unit): TransactionForTest {
|
@ -43,6 +43,9 @@ val USD = Currency.getInstance("USD")
|
||||
val GBP = Currency.getInstance("GBP")
|
||||
val CHF = Currency.getInstance("CHF")
|
||||
|
||||
val Int.DOLLARS: Amount get() = Amount(this, USD)
|
||||
val Int.POUNDS: Amount get() = Amount(this, GBP)
|
||||
val Int.SWISS_FRANCS: Amount get() = Amount(this, CHF)
|
||||
val Int.DOLLARS: Amount get() = Amount(this * 100, USD)
|
||||
val Int.POUNDS: Amount get() = Amount(this * 100, GBP)
|
||||
val Int.SWISS_FRANCS: Amount get() = Amount(this * 100, CHF)
|
||||
val Double.DOLLARS: Amount get() = Amount((this * 100).toInt(), USD)
|
||||
val Double.POUNDS: Amount get() = Amount((this * 100).toInt(), USD)
|
||||
val Double.SWISS_FRANCS: Amount get() = Amount((this * 100).toInt(), USD)
|
Loading…
Reference in New Issue
Block a user