mirror of
https://github.com/corda/corda.git
synced 2025-04-11 13:21:26 +00:00
CORDA-2313 Add test for (de-)evolution where new parameter is of unknown type (#4406)
This commit is contained in:
parent
4b14c47319
commit
ed3bc27501
@ -689,4 +689,26 @@ class EvolvabilityTests {
|
||||
assertEquals(4, deserializedC.d)
|
||||
assertEquals(5, deserializedC.e)
|
||||
}
|
||||
|
||||
// Class as it was serialized, with additional enum field.
|
||||
// enum class NewEnum { ONE, TWO, BUCKLE_MY_SHOE }
|
||||
// data class Evolved(val fnord: String, val newEnum: NewEnum)
|
||||
|
||||
// Class before evolution
|
||||
data class Evolved(val fnord: String)
|
||||
|
||||
@Test
|
||||
fun evolutionWithCarpentry() {
|
||||
val resource = "EvolvabilityTests.evolutionWithCarpentry"
|
||||
val sf = testDefaultFactory()
|
||||
// Uncomment to recreate
|
||||
// File(URI("$localPath/$resource")).writeBytes(SerializationOutput(sf).serialize(Evolved("dronf", NewEnum.BUCKLE_MY_SHOE)).bytes)
|
||||
|
||||
val url = EvolvabilityTests::class.java.getResource(resource)
|
||||
|
||||
val sc2 = url.readBytes()
|
||||
val deserialized = DeserializationInput(sf).deserialize(SerializedBytes<Evolved>(sc2))
|
||||
|
||||
assertEquals("dronf", deserialized.fnord)
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user