Skip to content
Snippets Groups Projects
Commit 518506a7 authored by Richard Benkovsky's avatar Richard Benkovsky
Browse files

Added tests for Utils.copyStream

parent f162fc2b
No related branches found
No related tags found
No related merge requests found
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))
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment