summaryrefslogtreecommitdiff
path: root/src/test/scala/cc/spray
diff options
context:
space:
mode:
authorJohannes Rudolph <johannes_rudolph@gmx.de>2012-05-29 15:48:50 +0200
committerJohannes Rudolph <johannes_rudolph@gmx.de>2012-05-29 15:48:50 +0200
commit745cea9069c626db16f29132767355a7d3d14d2c (patch)
tree6c2e05dbef88ab763e248ae93a09d481be5c8122 /src/test/scala/cc/spray
parent5aa2dff8b2559e7b90c189994cf004da6263b024 (diff)
downloadspray-json-745cea9069c626db16f29132767355a7d3d14d2c.tar.gz
spray-json-745cea9069c626db16f29132767355a7d3d14d2c.tar.bz2
spray-json-745cea9069c626db16f29132767355a7d3d14d2c.zip
refactored + improved error handling
Diffstat (limited to 'src/test/scala/cc/spray')
-rw-r--r--src/test/scala/cc/spray/json/JsonLensesSpec.scala8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/test/scala/cc/spray/json/JsonLensesSpec.scala b/src/test/scala/cc/spray/json/JsonLensesSpec.scala
index d1df898..1648690 100644
--- a/src/test/scala/cc/spray/json/JsonLensesSpec.scala
+++ b/src/test/scala/cc/spray/json/JsonLensesSpec.scala
@@ -34,7 +34,7 @@ class JsonLensesSpec extends Specification {
json extract "n".get[Int] must be_==(2)
}
"missing" in {
- json extract "z".get[Int] must throwAn[IllegalArgumentException]("""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,"els":[{"name":"John","money":23},{"name":"Paul","money":42}]}'""")
}
"wrong type" in {
json extract "n".get[String] must throwA[DeserializationException]("Expected String as JsString, but got 2")
@@ -101,7 +101,7 @@ class JsonLensesSpec extends Specification {
}
"missing" in {
val simple = JsonParser( """{"n": 12}""")
- simple.update(field("z") ! updated[Int](_ + 1)) must throwAn[IllegalArgumentException]("Need a value to operate on")
+ simple.update(field("z") ! updated[Int](_ + 1)) must throwAn[Exception]("Need a value to operate on")
}
}
"set field of member" in {
@@ -115,7 +115,11 @@ class JsonLensesSpec extends Specification {
json update ("n" / "b" ! updated[Int](1 +)) must be_json( """{"n": {"b": 5}}""")
}
+ "parent missing" in {
+ val json = JsonParser( """{"x": {"b": 4}}""")
+ json update ("n" / "b" ! updated[Int](1 +)) must throwAn[Exception]("Missing parent value")
+ }
}
"set element of array" in {
val json = JsonParser("""["a", "b", 2, 5, 8, 3]""")