aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/xyz/driver/core/JsonTest.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/scala/xyz/driver/core/JsonTest.scala')
-rw-r--r--src/test/scala/xyz/driver/core/JsonTest.scala8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/scala/xyz/driver/core/JsonTest.scala b/src/test/scala/xyz/driver/core/JsonTest.scala
index fed2a9d..2c85560 100644
--- a/src/test/scala/xyz/driver/core/JsonTest.scala
+++ b/src/test/scala/xyz/driver/core/JsonTest.scala
@@ -135,6 +135,14 @@ class JsonTest extends FlatSpec with Matchers {
parsedPhoneNumber should be(referencePhoneNumber)
}
+ it should "reject an invalid phone number" in {
+ val phoneJson = """{"countryCode":"1","number":"111-111-1113"}""".parseJson
+
+ intercept[DeserializationException] {
+ json.phoneNumberFormat.read(phoneJson)
+ }.getMessage shouldBe "Invalid phone number"
+ }
+
"Json format for ADT mappings" should "read and write correct JSON" in {
sealed trait EnumVal