diff --git a/akka-actor-tests/src/test/scala/akka/util/ByteStringSpec.scala b/akka-actor-tests/src/test/scala/akka/util/ByteStringSpec.scala index db7162c3be..d3d4371c26 100644 --- a/akka-actor-tests/src/test/scala/akka/util/ByteStringSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/util/ByteStringSpec.scala @@ -266,6 +266,16 @@ class ByteStringSpec extends WordSpec with MustMatchers with Checkers { } } + "calling take and drop" in { + check { slice: ByteStringSlice ⇒ + slice match { + case (xs, from, until) ⇒ likeVecIt(xs)({ + _.drop(from).take(until - from).toSeq + }, strict = false) + } + } + } + "calling copyToArray" in { check { slice: ByteStringSlice ⇒ slice match { @@ -320,6 +330,18 @@ class ByteStringSpec extends WordSpec with MustMatchers with Checkers { ((output.length < 1) || (input.asInputStream.read(output, 0, 1) == -1)) } } + + "calling copyToBuffer" in { + check { bytes: ByteString ⇒ + import java.nio.ByteBuffer + val buffer = ByteBuffer.allocate(bytes.size) + bytes.copyToBuffer(buffer) + buffer.flip() + val array = Array.ofDim[Byte](bytes.size) + buffer.get(array) + bytes == array.toSeq + } + } } "decode data correctly" when {