aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Odersky <jakob@odersky.com>2018-03-06 21:40:40 -0800
committerJakob Odersky <jakob@odersky.com>2018-03-06 21:40:40 -0800
commit1a2b7888c44b7e87e798b6953704fbee5a4958c7 (patch)
treeb8a39b8675a1681f94cf1b7319425b718e671b72
parent649a22c469647f095b93082a00c01b44fa2a6570 (diff)
downloadspray-json-derivation-1a2b7888c44b7e87e798b6953704fbee5a4958c7.tar.gz
spray-json-derivation-1a2b7888c44b7e87e798b6953704fbee5a4958c7.tar.bz2
spray-json-derivation-1a2b7888c44b7e87e798b6953704fbee5a4958c7.zip
Revise naming in testsv0.2.0
-rw-r--r--src/test/scala/CoproductTypeFormats.scala14
-rw-r--r--src/test/scala/FormatTests.scala2
-rw-r--r--src/test/scala/ProductTypeFormats.scala12
3 files changed, 14 insertions, 14 deletions
diff --git a/src/test/scala/CoproductTypeFormats.scala b/src/test/scala/CoproductTypeFormats.scala
index e20871c..6496e00 100644
--- a/src/test/scala/CoproductTypeFormats.scala
+++ b/src/test/scala/CoproductTypeFormats.scala
@@ -16,22 +16,22 @@ class CoproductTypeFormats
case class Plus(lhs: Expr, rhs: Expr) extends Expr
case object One extends Expr
- "No-parameter case class child" should behave like checkCoherence[Expr](
+ "No-parameter case class child" should behave like checkRoundtrip[Expr](
Zero(),
"""{"type":"Zero"}"""
)
- "Simple parameter case class child" should behave like checkCoherence[Expr](
+ "Simple parameter case class child" should behave like checkRoundtrip[Expr](
Value(42),
"""{"type":"Value","x":42}"""
)
- "Nested parameter case class child" should behave like checkCoherence[Expr](
+ "Nested parameter case class child" should behave like checkRoundtrip[Expr](
Plus(Value(42), One),
"""{"type":"Plus","lhs":{"type":"Value","x":42},"rhs":{"type":"One"}}"""
)
- "Case object child" should behave like checkCoherence[Expr](
+ "Case object child" should behave like checkRoundtrip[Expr](
One,
"""{"type": "One"}"""
)
@@ -40,7 +40,7 @@ class CoproductTypeFormats
sealed abstract class Keyword(`type`: String)
case class If(`type`: String) extends Keyword(`type`)
- "GADT with type field alias" should behave like checkCoherence[Keyword](
+ "GADT with type field alias" should behave like checkRoundtrip[Keyword](
If("class"),
"""{"kind":"If","type":"class"}"""
)
@@ -49,7 +49,7 @@ class CoproductTypeFormats
sealed abstract trait Crazy
case class CrazyType() extends Crazy
- "GADT with special characters in type field" should behave like checkCoherence[
+ "GADT with special characters in type field" should behave like checkRoundtrip[
Crazy](
CrazyType(),
"""{"_`crazy type!`\"": "CrazyType"}"""
@@ -59,7 +59,7 @@ class CoproductTypeFormats
case object A extends Enum
case object B extends Enum
- "Enum" should behave like checkCoherence[List[Enum]](
+ "Enum" should behave like checkRoundtrip[List[Enum]](
A :: B :: Nil,
"""[{"type":"A"}, {"type":"B"}]"""
)
diff --git a/src/test/scala/FormatTests.scala b/src/test/scala/FormatTests.scala
index 68a4765..f9cae2d 100644
--- a/src/test/scala/FormatTests.scala
+++ b/src/test/scala/FormatTests.scala
@@ -5,7 +5,7 @@ import org.scalatest._
trait FormatTests { self: FlatSpec =>
- def checkCoherence[A: RootJsonFormat](a: A, expectedJson: String) = {
+ def checkRoundtrip[A: RootJsonFormat](a: A, expectedJson: String) = {
it should "serialize to the expected JSON value" in {
val expected: JsValue = expectedJson.parseJson
assert(a.toJson == expected)
diff --git a/src/test/scala/ProductTypeFormats.scala b/src/test/scala/ProductTypeFormats.scala
index 48f1bf1..02fb554 100644
--- a/src/test/scala/ProductTypeFormats.scala
+++ b/src/test/scala/ProductTypeFormats.scala
@@ -17,24 +17,24 @@ class ProductTypeFormats
case class E(d: D.type)
case class F(x: Int)
- "No-parameter product" should behave like checkCoherence(A(), "{}")
+ "No-parameter product" should behave like checkRoundtrip(A(), "{}")
- "Simple parameter product" should behave like checkCoherence(
+ "Simple parameter product" should behave like checkRoundtrip(
B(42, "Hello World", Map("a" -> 1, "b" -> -1024)),
"""{ "x": 42, "b": "Hello World", "mp": { "a": 1, "b": -1024 } }"""
)
- "Nested parameter product" should behave like checkCoherence(
+ "Nested parameter product" should behave like checkRoundtrip(
C(B(42, "Hello World", Map("a" -> 1, "b" -> -1024))),
"""{"b" :{ "x": 42, "b": "Hello World", "mp": { "a": 1, "b": -1024 } } }"""
)
- "Case object" should behave like checkCoherence(
+ "Case object" should behave like checkRoundtrip(
D,
"{}"
)
- "Case object as parameter" should behave like checkCoherence(
+ "Case object as parameter" should behave like checkRoundtrip(
E(D),
"""{"d":{}}"""
)
@@ -46,7 +46,7 @@ class ProductTypeFormats
F(-js.asJsObject.fields("x").convertTo[Int])
}
- "Overriding with a custom format" should behave like checkCoherence(
+ "Overriding with a custom format" should behave like checkRoundtrip(
F(2),
"""{"x":-2}"""
)