-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #318 from commercetools/JSON_instance
find JSON instance from FromJSON and ToJSON
- Loading branch information
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
json/json-core/src/test/scala/io/sphere/json/JSONSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.sphere.json | ||
|
||
import org.json4s.JsonAST.JValue | ||
import org.scalatest.matchers.must.Matchers | ||
import org.scalatest.wordspec.AnyWordSpec | ||
|
||
class JSONSpec extends AnyWordSpec with Matchers { | ||
import JSONSpec._ | ||
"JSON.apply" must { | ||
"find possible JSON instance" in { | ||
implicit val testJson: JSON[Test] = new JSON[Test] { | ||
override def read(jval: JValue): JValidation[Test] = ??? | ||
override def write(value: Test): JValue = ??? | ||
} | ||
JSON[Test] must be(testJson) | ||
} | ||
"create instance from FromJSON and ToJSON" in { | ||
JSON[Int] | ||
JSON[List[Double]] | ||
JSON[Map[String, Int]] | ||
} | ||
} | ||
} | ||
|
||
object JSONSpec { | ||
case class Test(a: String) | ||
} |