@@ -28,12 +28,14 @@ class ChunkedByteBufferOutputStreamSuite extends SparkFunSuite {
2828
2929 test(" empty output" ) {
3030 val o = new ChunkedByteBufferOutputStream (1024 , ByteBuffer .allocate)
31+ o.close()
3132 assert(o.toChunkedByteBuffer.size === 0 )
3233 }
3334
3435 test(" write a single byte" ) {
3536 val o = new ChunkedByteBufferOutputStream (1024 , ByteBuffer .allocate)
3637 o.write(10 )
38+ o.close()
3739 val chunkedByteBuffer = o.toChunkedByteBuffer
3840 assert(chunkedByteBuffer.getChunks().length === 1 )
3941 assert(chunkedByteBuffer.getChunks().head.array().toSeq === Seq (10 .toByte))
@@ -43,6 +45,7 @@ class ChunkedByteBufferOutputStreamSuite extends SparkFunSuite {
4345 val o = new ChunkedByteBufferOutputStream (10 , ByteBuffer .allocate)
4446 o.write(new Array [Byte ](9 ))
4547 o.write(99 )
48+ o.close()
4649 val chunkedByteBuffer = o.toChunkedByteBuffer
4750 assert(chunkedByteBuffer.getChunks().length === 1 )
4851 assert(chunkedByteBuffer.getChunks().head.array()(9 ) === 99 .toByte)
@@ -52,6 +55,7 @@ class ChunkedByteBufferOutputStreamSuite extends SparkFunSuite {
5255 val o = new ChunkedByteBufferOutputStream (10 , ByteBuffer .allocate)
5356 o.write(new Array [Byte ](10 ))
5457 o.write(99 )
58+ o.close()
5559 val arrays = o.toChunkedByteBuffer.getChunks().map(_.array())
5660 assert(arrays.length === 2 )
5761 assert(arrays(1 ).length === 1 )
@@ -63,6 +67,7 @@ class ChunkedByteBufferOutputStreamSuite extends SparkFunSuite {
6367 Random .nextBytes(ref)
6468 val o = new ChunkedByteBufferOutputStream (10 , ByteBuffer .allocate)
6569 o.write(ref)
70+ o.close()
6671 val arrays = o.toChunkedByteBuffer.getChunks().map(_.array())
6772 assert(arrays.length === 1 )
6873 assert(arrays.head.length === ref.length)
@@ -74,6 +79,7 @@ class ChunkedByteBufferOutputStreamSuite extends SparkFunSuite {
7479 Random .nextBytes(ref)
7580 val o = new ChunkedByteBufferOutputStream (10 , ByteBuffer .allocate)
7681 o.write(ref)
82+ o.close()
7783 val arrays = o.toChunkedByteBuffer.getChunks().map(_.array())
7884 assert(arrays.length === 1 )
7985 assert(arrays.head.length === ref.length)
@@ -85,6 +91,7 @@ class ChunkedByteBufferOutputStreamSuite extends SparkFunSuite {
8591 Random .nextBytes(ref)
8692 val o = new ChunkedByteBufferOutputStream (10 , ByteBuffer .allocate)
8793 o.write(ref)
94+ o.close()
8895 val arrays = o.toChunkedByteBuffer.getChunks().map(_.array())
8996 assert(arrays.length === 3 )
9097 assert(arrays(0 ).length === 10 )
@@ -101,6 +108,7 @@ class ChunkedByteBufferOutputStreamSuite extends SparkFunSuite {
101108 Random .nextBytes(ref)
102109 val o = new ChunkedByteBufferOutputStream (10 , ByteBuffer .allocate)
103110 o.write(ref)
111+ o.close()
104112 val arrays = o.toChunkedByteBuffer.getChunks().map(_.array())
105113 assert(arrays.length === 3 )
106114 assert(arrays(0 ).length === 10 )
0 commit comments