summaryrefslogtreecommitdiff
path: root/src/test/scala/cc/spray/json/JsonParserSpec.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/scala/cc/spray/json/JsonParserSpec.scala')
-rw-r--r--src/test/scala/cc/spray/json/JsonParserSpec.scala22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/test/scala/cc/spray/json/JsonParserSpec.scala b/src/test/scala/cc/spray/json/JsonParserSpec.scala
index 0860d05..cfe270f 100644
--- a/src/test/scala/cc/spray/json/JsonParserSpec.scala
+++ b/src/test/scala/cc/spray/json/JsonParserSpec.scala
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2011 Mathias Doenitz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package cc.spray.json
import org.specs2.mutable._
@@ -35,16 +51,16 @@ class JsonParserSpec extends Specification {
}
"properly parse a simple JsObject" in (
JsonParser(""" { "key" :42, "key2": "value" }""") mustEqual
- JsObject(JsField("key", 42), JsField("key2", "value"))
+ JsObject("key" -> JsNumber(42), "key2" -> JsString("value"))
)
"properly parse a simple JsArray" in (
JsonParser("""[null, 1.23 ,{"key":true } ] """) mustEqual
- JsArray(JsNull, JsNumber(1.23), JsObject(JsField("key", true)))
+ JsArray(JsNull, JsNumber(1.23), JsObject("key" -> JsBoolean(true)))
)
"be reentrant" in {
val largeJsonSource = FileUtils.readAllCharsFromResource("test.json")
List.fill(20)(largeJsonSource).par.map(JsonParser(_)).toList.map {
- _.asInstanceOf[JsObject].asMap("questions").asInstanceOf[JsArray].elements.size
+ _.asInstanceOf[JsObject].fields("questions").asInstanceOf[JsArray].elements.size
} mustEqual List.fill(20)(100)
}
}