summaryrefslogtreecommitdiff
path: root/src/test/scala
diff options
context:
space:
mode:
authorJohannes Rudolph <johannes_rudolph@gmx.de>2012-05-29 16:12:25 +0200
committerJohannes Rudolph <johannes_rudolph@gmx.de>2012-05-29 16:12:25 +0200
commitfb5ec7cd5aba2c3ec3e6985a2214f0ecc94e3e77 (patch)
tree121cab7e41e4899f172d2c9e26a6068f8e0d9a18 /src/test/scala
parent5bb3c54a0cdbf99efad736fd7fb7bd83a0c8e0d9 (diff)
downloadspray-json-fb5ec7cd5aba2c3ec3e6985a2214f0ecc94e3e77.tar.gz
spray-json-fb5ec7cd5aba2c3ec3e6985a2214f0ecc94e3e77.tar.bz2
spray-json-fb5ec7cd5aba2c3ec3e6985a2214f0ecc94e3e77.zip
simplify test case
Diffstat (limited to 'src/test/scala')
-rw-r--r--src/test/scala/cc/spray/json/JsonLensesSpec.scala19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/test/scala/cc/spray/json/JsonLensesSpec.scala b/src/test/scala/cc/spray/json/JsonLensesSpec.scala
index c26537a..179a1ae 100644
--- a/src/test/scala/cc/spray/json/JsonLensesSpec.scala
+++ b/src/test/scala/cc/spray/json/JsonLensesSpec.scala
@@ -7,22 +7,6 @@ import org.specs2.matcher.{BeMatching, Matcher}
import java.util.regex.Pattern
class JsonLensesSpec extends Specification {
- val json = JsonParser(
- """{
- | "n": 2,
- | "els": [
- | {
- | "name": "John",
- | "money": 23
- | },
- | {
- | "name": "Paul",
- | "money": 42
- | }
- | ]
- |}
- """.stripMargin)
-
import JsonLenses._
val n = field("n")
@@ -30,11 +14,12 @@ class JsonLensesSpec extends Specification {
"Lenses" should {
"access" in {
"field" in {
+ val json = JsonParser("""{"n": 2}""")
"existing" in {
json extract "n".get[Int] must be_==(2)
}
"missing" in {
- json extract "z".get[Int] must throwAn[Exception]("""Expected field 'z' in '{"n":2,"els":[{"name":"John","money":23},{"name":"Paul","money":42}]}'""")
+ json extract "z".get[Int] must throwAn[Exception]("""Expected field 'z' in '{"n":2}'""")
}
"wrong type" in {
json extract "n".get[String] must throwA[DeserializationException]("Expected String as JsString, but got 2")