File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
src/test/scala/com/fasterxml/jackson/module/scala/deser Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 1
1
package com .fasterxml .jackson .module .scala .deser
2
2
3
3
import com .fasterxml .jackson .databind .annotation .JsonDeserialize
4
+ import com .fasterxml .jackson .databind .exc .InvalidFormatException
4
5
import com .fasterxml .jackson .module .scala .DefaultScalaModule
5
6
import com .fasterxml .jackson .module .scala .introspect .ScalaAnnotationIntrospector
6
7
import org .scalatest .BeforeAndAfterEach
@@ -50,6 +51,12 @@ class OptionWithNumberDeserializerTest extends DeserializerTest with BeforeAndAf
50
51
useOptionLong(v1.valueLong) shouldBe 302L
51
52
}
52
53
54
+ it should " fail to deserialize OptionLong when value is text" in {
55
+ intercept[InvalidFormatException ] {
56
+ deserialize(""" {"valueLong":"xy"}""" , classOf [OptionLong ])
57
+ }.getMessage should include(""" Cannot deserialize value of type `long` from String "xy": not a valid `long` value""" )
58
+ }
59
+
53
60
it should " deserialize OptionJavaLong" in {
54
61
val v1 = deserialize(""" {"valueLong":151}""" , classOf [OptionJavaLong ])
55
62
v1 shouldBe OptionJavaLong (Some (151L ))
You can’t perform that action at this time.
0 commit comments