diff options
author | Sergey Nastich <nastich@users.noreply.github.com> | 2018-09-12 16:10:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-12 16:10:17 -0400 |
commit | 8fef53d44a57008dea411b882b12bc3d5d1ca2e0 (patch) | |
tree | d2304188d61bdd39ee4c494f3e309c209908592a /src/test/scala/xyz/driver/core/JsonTest.scala | |
parent | ccd6c4281fb0ddd0a74b79aa24f85834f5c9647a (diff) | |
download | driver-core-1.14.2.tar.gz driver-core-1.14.2.tar.bz2 driver-core-1.14.2.zip |
Add `Trimmed` tag and its logic (revisited) (#215)v1.14.2
* Add option and iterable converters for transparent `@@ Trimmed` creation.
* Move tagging stuff to a separate package - relieve `core.scala` from some extra code.
* Add Tagging stuff and publishing section to README.md
Diffstat (limited to 'src/test/scala/xyz/driver/core/JsonTest.scala')
-rw-r--r-- | src/test/scala/xyz/driver/core/JsonTest.scala | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/test/scala/xyz/driver/core/JsonTest.scala b/src/test/scala/xyz/driver/core/JsonTest.scala index 9a079b2..2aa3572 100644 --- a/src/test/scala/xyz/driver/core/JsonTest.scala +++ b/src/test/scala/xyz/driver/core/JsonTest.scala @@ -18,11 +18,12 @@ import xyz.driver.core.auth.AuthCredentials import xyz.driver.core.domain.{Email, PhoneNumber} import xyz.driver.core.json._ import xyz.driver.core.json.enumeratum.HasJsonFormat -import xyz.driver.core.tagging.Taggable +import xyz.driver.core.tagging._ import xyz.driver.core.time.provider.SystemTimeProvider import xyz.driver.core.time.{Time, TimeOfDay} import scala.collection.immutable.IndexedSeq +import scala.language.postfixOps class JsonTest extends WordSpec with Matchers with Inspectors { import DefaultJsonProtocol._ @@ -55,10 +56,12 @@ class JsonTest extends WordSpec with Matchers with Inspectors { } "read and write correct JSON when there's an implicit conversion defined" in { - JsString(" some string ").convertTo[String @@ Trimmed] shouldBe "some string" + val input = " some string " - val trimmed: String @@ Trimmed = " some string " - trimmed.toJson shouldBe JsString("some string") + JsString(input).convertTo[String @@ Trimmed] shouldBe input.trim() + + val trimmed: String @@ Trimmed = input + trimmed.toJson shouldBe JsString(trimmed) } } |