summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorMathias <mathias@spray.io>2015-05-06 15:33:05 +0200
committerMathias <mathias@spray.io>2015-05-06 15:34:50 +0200
commit0477e5082dc8cac5e15b7911b9c6e022be6e0c0a (patch)
tree61d20d6a8b82a763d5e400d74087605eb941f554 /src/test
parent629c6ef4b4e795b900d5d870fd5cb282d538f70a (diff)
downloadspray-json-0477e5082dc8cac5e15b7911b9c6e022be6e0c0a.tar.gz
spray-json-0477e5082dc8cac5e15b7911b9c6e022be6e0c0a.tar.bz2
spray-json-0477e5082dc8cac5e15b7911b9c6e022be6e0c0a.zip
Improve test coverage of automatic case class member name unmangling
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/spray/json/ProductFormatsSpec.scala10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/test/scala/spray/json/ProductFormatsSpec.scala b/src/test/scala/spray/json/ProductFormatsSpec.scala
index c218a9d..30582a8 100644
--- a/src/test/scala/spray/json/ProductFormatsSpec.scala
+++ b/src/test/scala/spray/json/ProductFormatsSpec.scala
@@ -29,7 +29,7 @@ class ProductFormatsSpec extends Specification {
}
@SerialVersionUID(1L) // SerialVersionUID adds a static field to the case class
case class TestStatic(a: Int, b: Option[Double])
- case class TestMangled(`foo-bar!`: Int, `User ID`: String, `üt$bavef$u56úrógép`: Boolean, `-x-`: Int)
+ case class TestMangled(`foo-bar!`: Int, `User ID`: String, `ü$bavf$u56ú$`: Boolean, `-x-`: Int, `=><+-*/!@#%^&~?|`: Float)
trait TestProtocol {
this: DefaultJsonProtocol =>
@@ -39,7 +39,7 @@ class ProductFormatsSpec extends Specification {
implicit def test4Format = jsonFormat1(Test4)
implicit def testTransientFormat = jsonFormat2(TestTransient)
implicit def testStaticFormat = jsonFormat2(TestStatic)
- implicit def testMangledFormat = jsonFormat4(TestMangled)
+ implicit def testMangledFormat = jsonFormat5(TestMangled)
}
object TestProtocol1 extends DefaultJsonProtocol with TestProtocol
object TestProtocol2 extends DefaultJsonProtocol with TestProtocol with NullOptions
@@ -198,12 +198,12 @@ class ProductFormatsSpec extends Specification {
"A JsonFormat created with `jsonFormat`, for a case class with mangled-name members," should {
import TestProtocol1._
- val json = """{"foo-bar!":42,"User ID":"Karl","üt$bavef$u56úrógép":true,"-x-":26}"""
+ val json = """{"ü$bavf$u56ú$":true,"=><+-*/!@#%^&~?|":1.0,"foo-bar!":42,"-x-":26,"User ID":"Karl"}"""
"produce the correct JSON" in {
- TestMangled(42, "Karl", true, 26).toJson.compactPrint === json
+ TestMangled(42, "Karl", true, 26, 1.0f).toJson.compactPrint === json
}
"convert a JsObject to the respective case class instance" in {
- json.parseJson.convertTo[TestMangled] === TestMangled(42, "Karl", true, 26)
+ json.parseJson.convertTo[TestMangled] === TestMangled(42, "Karl", true, 26, 1.0f)
}
}
}