Skip to content

Commit

Permalink
CORDA-2313 Add test for (de-)evolution where new parameter is of unkn…
Browse files Browse the repository at this point in the history
…own type (corda#4406)
  • Loading branch information
r3domfox authored Dec 12, 2018
1 parent 4b14c47 commit ed3bc27
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit ed3bc27

Please sign in to comment.