mirror of
https://github.com/corda/corda.git
synced 2025-06-18 15:18:16 +00:00
CORDA-2765 Make TransactionVerificationExceptions serializable (#4908)
This commit is contained in:
@ -24,6 +24,7 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
private val context get() = AMQP_RPC_CLIENT_CONTEXT
|
||||
|
||||
private val txid = SecureHash.allOnesHash
|
||||
private val attachmentHash = SecureHash.allOnesHash
|
||||
private val factory = defaultFactory()
|
||||
|
||||
@Test
|
||||
@ -123,4 +124,55 @@ class TransactionVerificationExceptionSerialisationTests {
|
||||
assertEquals(exception.cause?.message, exception2.cause?.message)
|
||||
assertEquals(exception.txId, exception2.txId)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overlappingAttachmentsExceptionTest() {
|
||||
val exc = TransactionVerificationException.OverlappingAttachmentsException(txid, "foo/bar/baz")
|
||||
val exc2 = DeserializationInput(factory).deserialize(
|
||||
SerializationOutput(factory).serialize(exc, context),
|
||||
context)
|
||||
|
||||
assertEquals(exc.message, exc2.message)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun packageOwnershipExceptionTest() {
|
||||
val exc = TransactionVerificationException.PackageOwnershipException(
|
||||
txid,
|
||||
attachmentHash,
|
||||
"InvalidClass",
|
||||
"com.invalid")
|
||||
|
||||
val exc2 = DeserializationInput(factory).deserialize(
|
||||
SerializationOutput(factory).serialize(exc, context),
|
||||
context)
|
||||
|
||||
assertEquals(exc.message, exc2.message)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun invalidAttachmentExceptionTest() {
|
||||
val exc = TransactionVerificationException.InvalidAttachmentException(
|
||||
txid,
|
||||
attachmentHash)
|
||||
|
||||
val exc2 = DeserializationInput(factory).deserialize(
|
||||
SerializationOutput(factory).serialize(exc, context),
|
||||
context)
|
||||
|
||||
assertEquals(exc.message, exc2.message)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun untrustedAttachmentsExceptionTest() {
|
||||
val exc = TransactionVerificationException.UntrustedAttachmentsException(
|
||||
txid,
|
||||
listOf(attachmentHash))
|
||||
|
||||
val exc2 = DeserializationInput(factory).deserialize(
|
||||
SerializationOutput(factory).serialize(exc, context),
|
||||
context)
|
||||
|
||||
assertEquals(exc.message, exc2.message)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user