diff options
author | Aleksandr <ognelisar@gmail.com> | 2018-04-03 10:48:10 +0700 |
---|---|---|
committer | Aleksandr <ognelisar@gmail.com> | 2018-04-03 10:48:10 +0700 |
commit | acf366c1a7f4b7dc7758d8a73b2e497068bb1fe8 (patch) | |
tree | faf601fa831be596fffaeb737a52e508a1473523 /src/test/scala/xyz/driver/core/JsonTest.scala | |
parent | 04a21e9a5ab46f885cb51626d274d570fefe4a29 (diff) | |
parent | 322bbc9010e20195e5b0bb58e703961738ffb89d (diff) | |
download | driver-core-acf366c1a7f4b7dc7758d8a73b2e497068bb1fe8.tar.gz driver-core-acf366c1a7f4b7dc7758d8a73b2e497068bb1fe8.tar.bz2 driver-core-acf366c1a7f4b7dc7758d8a73b2e497068bb1fe8.zip |
Merge branch 'master' into TM-1431
Diffstat (limited to 'src/test/scala/xyz/driver/core/JsonTest.scala')
-rw-r--r-- | src/test/scala/xyz/driver/core/JsonTest.scala | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/scala/xyz/driver/core/JsonTest.scala b/src/test/scala/xyz/driver/core/JsonTest.scala index a45025a..827624c 100644 --- a/src/test/scala/xyz/driver/core/JsonTest.scala +++ b/src/test/scala/xyz/driver/core/JsonTest.scala @@ -11,6 +11,7 @@ import xyz.driver.core.time.provider.SystemTimeProvider import spray.json._ import xyz.driver.core.TestTypes.CustomGADT import xyz.driver.core.domain.{Email, PhoneNumber} +import xyz.driver.core.time.TimeOfDay class JsonTest extends FlatSpec with Matchers { import DefaultJsonProtocol._ @@ -61,6 +62,15 @@ class JsonTest extends FlatSpec with Matchers { parsedTime should be(referenceTime) } + "Json format for TimeOfDay" should "read and write correct JSON" in { + val utcTimeZone = java.util.TimeZone.getTimeZone("UTC") + val referenceTimeOfDay = TimeOfDay.parseTimeString(utcTimeZone)("08:00:00") + val writtenJson = json.timeOfDayFormat.write(referenceTimeOfDay) + writtenJson should be("""{"localTime":"08:00:00","timeZone":"UTC"}""".parseJson) + val parsed = json.timeOfDayFormat.read(writtenJson) + parsed should be(referenceTimeOfDay) + } + "Json format for Date" should "read and write correct JSON" in { import date._ |