Make serialise putObject function an open function

For testing I need to be able to mess with the schema before it gets
added to the envelope, extract the function where that happens and make
it open so the tests can do what they want
This commit is contained in:
Katelyn Baker 2017-07-12 14:37:02 +01:00
parent 78ecff7933
commit 534f60dc57

View File

@ -34,7 +34,7 @@ open class SerializationOutput(internal val serializerFactory: SerializerFactory
// Our object // Our object
writeObject(obj, this) writeObject(obj, this)
// The schema // The schema
putObject(Schema(schemaHistory.toList())) putObject(Schema(schemaHistory.toList()), this)
} }
} }
val bytes = ByteArray(data.encodedSize().toInt() + 8) val bytes = ByteArray(data.encodedSize().toInt() + 8)
@ -53,6 +53,10 @@ open class SerializationOutput(internal val serializerFactory: SerializerFactory
writeObject(obj, data, obj.javaClass) writeObject(obj, data, obj.javaClass)
} }
open fun putObject(schema: Schema, data: Data) {
data.putObject(schema)
}
internal fun writeObjectOrNull(obj: Any?, data: Data, type: Type) { internal fun writeObjectOrNull(obj: Any?, data: Data, type: Type) {
if (obj == null) { if (obj == null) {
data.putNull() data.putNull()