diff options
author | Richard Benkovsky <richard.benkovsky@gooddata.com> | 2012-05-19 15:42:54 +0200 |
---|---|---|
committer | Richard Benkovsky <richard.benkovsky@gooddata.com> | 2012-05-22 11:04:51 +0200 |
commit | 518506a7c504ea84d93e6354f8cc7e9187c48317 (patch) | |
tree | 487cf2a6c482ba127535abed4662b521ae691f41 /core | |
parent | f162fc2bebeb88314ea2f7c072d75bdf03efc55e (diff) | |
download | spark-518506a7c504ea84d93e6354f8cc7e9187c48317.tar.gz spark-518506a7c504ea84d93e6354f8cc7e9187c48317.tar.bz2 spark-518506a7c504ea84d93e6354f8cc7e9187c48317.zip |
Added tests for Utils.copyStream
Diffstat (limited to 'core')
-rw-r--r-- | core/src/test/scala/spark/UtilsSuite.scala (renamed from core/src/test/scala/spark/Utils.scala) | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/core/src/test/scala/spark/Utils.scala b/core/src/test/scala/spark/UtilsSuite.scala index 4e852903be..f31251e509 100644 --- a/core/src/test/scala/spark/Utils.scala +++ b/core/src/test/scala/spark/UtilsSuite.scala @@ -1,7 +1,8 @@ package spark import org.scalatest.FunSuite - +import java.io.{ByteArrayOutputStream, ByteArrayInputStream} +import util.Random class UtilsSuite extends FunSuite { @@ -14,5 +15,15 @@ class UtilsSuite extends FunSuite { assert(Utils.memoryBytesToString(5368709120L) === "5.0GB") } + test("copyStream") { + //input array initialization + val bytes = Array.ofDim[Byte](9000) + Random.nextBytes(bytes) + + val os = new ByteArrayOutputStream() + Utils.copyStream(new ByteArrayInputStream(bytes), os) + + assert(os.toByteArray.toList.equals(bytes.toList)) + } } |