diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2019-10-13 21:25:12 +0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2019-10-13 21:25:12 +0800 |
commit | 7b8f403a0d3f95a825a09a709bc17a694952683d (patch) | |
tree | 053aa1f8e1f7d75df69597c6fb81fddd4acd1411 /example/websockets4 | |
parent | 114b385269c6f5049615e67c8c42dc25be337626 (diff) | |
download | cask-7b8f403a0d3f95a825a09a709bc17a694952683d.tar.gz cask-7b8f403a0d3f95a825a09a709bc17a694952683d.tar.bz2 cask-7b8f403a0d3f95a825a09a709bc17a694952683d.zip |
fix tests
Diffstat (limited to 'example/websockets4')
-rw-r--r-- | example/websockets4/app/test/src/ExampleTests.scala | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/example/websockets4/app/test/src/ExampleTests.scala b/example/websockets4/app/test/src/ExampleTests.scala index cd33bb4..f122228 100644 --- a/example/websockets4/app/test/src/ExampleTests.scala +++ b/example/websockets4/app/test/src/ExampleTests.scala @@ -37,14 +37,12 @@ object ExampleTests extends TestSuite{ Thread.sleep(100) out ==> List("haoyi world", "haoyi hello") - var error: String = "" - val ws2 = cask.WsClient.connect("ws://localhost:8080/connect/nobody") { - case cask.Ws.Text(s) => out = s :: out - case cask.Ws.Error(t) => error += t.toString - case cask.Ws.Close(code, reason) => error += reason - } - - assert(error.contains("403")) + val ex = intercept[Exception]( + cask.WsClient.connect("ws://localhost:8080/connect/nobody") { + case _ => /*do nothing*/ + } + ) + assert(ex.getMessage.contains("403")) }finally ws.close() } } |