Skip to content

Commit 4e4e9a1

Browse files
committed
Add test
1 parent 33368be commit 4e4e9a1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

core/src/test/scala/org/apache/spark/serializer/KryoSerializerSuite.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,20 @@ class KryoSerializerSuite extends SparkFunSuite with SharedSparkContext {
377377
Utils.deleteRecursively(dir)
378378
}
379379

380+
test("KryoOutputObjectOutputBridge.writeObject and KryoInputObjectInputBridge.readObject") {
381+
val kryo = new KryoSerializer(conf).newKryo()
382+
383+
val bytesOutput = new ByteArrayOutputStream()
384+
val objectOutput = new KryoOutputObjectOutputBridge(kryo, new KryoOutput(bytesOutput))
385+
objectOutput.writeObject("test")
386+
objectOutput.close()
387+
388+
val bytesInput = new ByteArrayInputStream(bytesOutput.toByteArray)
389+
val objectInput = new KryoInputObjectInputBridge(kryo, new KryoInput(bytesInput))
390+
assert(objectInput.readObject() === "test")
391+
objectInput.close()
392+
}
393+
380394
test("getAutoReset") {
381395
val ser = new KryoSerializer(new SparkConf).newInstance().asInstanceOf[KryoSerializerInstance]
382396
assert(ser.getAutoReset)

0 commit comments

Comments
 (0)