use ByteString.empty

* and a few other cleanups
This commit is contained in:
Patrik Nordwall 2016-06-01 12:24:50 +02:00
parent fe47d596bc
commit 184e45e6b2
9 changed files with 17 additions and 18 deletions

View file

@ -69,7 +69,7 @@ class RecipeByteStrings extends RecipeSpec {
val chunks = Await.result(chunksFuture, 3.seconds)
chunks.forall(_.size <= 2) should be(true)
chunks.fold(ByteString())(_ ++ _) should be(ByteString(1, 2, 3, 4, 5, 6, 7, 8, 9))
chunks.fold(ByteString.empty)(_ ++ _) should be(ByteString(1, 2, 3, 4, 5, 6, 7, 8, 9))
}
"have a working bytes limiter" in {
@ -108,7 +108,7 @@ class RecipeByteStrings extends RecipeSpec {
val bytes2 = Source(List(ByteString(1, 2), ByteString(3), ByteString(4, 5, 6), ByteString(7, 8, 9, 10)))
Await.result(bytes1.via(limiter).limit(10).runWith(Sink.seq), 3.seconds)
.fold(ByteString())(_ ++ _) should be(ByteString(1, 2, 3, 4, 5, 6, 7, 8, 9))
.fold(ByteString.empty)(_ ++ _) should be(ByteString(1, 2, 3, 4, 5, 6, 7, 8, 9))
an[IllegalStateException] must be thrownBy {
Await.result(bytes2.via(limiter).limit(10).runWith(Sink.seq), 3.seconds)