diff options
author | Mathias <mathias@spray.cc> | 2011-11-09 11:42:25 +0100 |
---|---|---|
committer | Mathias <mathias@spray.cc> | 2011-11-09 12:40:16 +0100 |
commit | 6cbaa4c1782bcb4060af9f8ef2fd72e737f7982a (patch) | |
tree | 32039efb3097ff16686819806da842539185d27f /src/test/scala/cc/spray/json/ProductFormatsSpec.scala | |
parent | 9cda445514efe7700544e2b121c2258a69b9b207 (diff) | |
download | spray-json-6cbaa4c1782bcb4060af9f8ef2fd72e737f7982a.tar.gz spray-json-6cbaa4c1782bcb4060af9f8ef2fd72e737f7982a.tar.bz2 spray-json-6cbaa4c1782bcb4060af9f8ef2fd72e737f7982a.zip |
Fix #6 (rename JsValue:fromJson to 'convertTo', add .prettyPrint and .compactPrint
Diffstat (limited to 'src/test/scala/cc/spray/json/ProductFormatsSpec.scala')
-rw-r--r-- | src/test/scala/cc/spray/json/ProductFormatsSpec.scala | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/test/scala/cc/spray/json/ProductFormatsSpec.scala b/src/test/scala/cc/spray/json/ProductFormatsSpec.scala index 9a692ec..7c643e9 100644 --- a/src/test/scala/cc/spray/json/ProductFormatsSpec.scala +++ b/src/test/scala/cc/spray/json/ProductFormatsSpec.scala @@ -23,26 +23,26 @@ class ProductFormatsSpec extends Specification { obj.toJson mustEqual json } "convert a JsObject to the respective case class instance" in { - json.fromJson[Test2] mustEqual obj + json.convertTo[Test2] mustEqual obj } "throw a DeserializationException if the JsObject does not all required members" in ( - JsObject(JsField("b", 4.2)).fromJson[Test2] must + JsObject(JsField("b", 4.2)).convertTo[Test2] must throwA(new DeserializationException("Object is missing required member 'a'")) ) "not require the presence of optional fields for deserialization" in { - JsObject(JsField("a", 42)).fromJson[Test2] mustEqual Test2(42, None) + JsObject(JsField("a", 42)).convertTo[Test2] mustEqual Test2(42, None) } "not render `None` members during serialization" in { Test2(42, None).toJson mustEqual JsObject(JsField("a", 42)) } "ignore additional members during deserialization" in { - JsObject(JsField("a", 42), JsField("b", 4.2), JsField("c", 'no)).fromJson[Test2] mustEqual obj + JsObject(JsField("a", 42), JsField("b", 4.2), JsField("c", 'no)).convertTo[Test2] mustEqual obj } "not depend on any specific member order for deserialization" in { - JsObject(JsField("b", 4.2), JsField("a", 42)).fromJson[Test2] mustEqual obj + JsObject(JsField("b", 4.2), JsField("a", 42)).convertTo[Test2] mustEqual obj } "throw a DeserializationException if the JsValue is not a JsObject" in ( - JsNull.fromJson[Test2] must throwA(new DeserializationException("Object expected")) + JsNull.convertTo[Test2] must throwA(new DeserializationException("Object expected")) ) } @@ -64,7 +64,7 @@ class ProductFormatsSpec extends Specification { obj.toJson mustEqual json } "convert a JsObject to the respective case class instance" in { - json.fromJson[Test3[Int, String]] mustEqual obj + json.convertTo[Test3[Int, String]] mustEqual obj } } |