File tree 3 files changed +38
-2
lines changed
src/test/scala/com/fasterxml/jackson/module/scala/deser 3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change 66
66
key : ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
67
67
68
68
- name : Check that workflows are up to date
69
- run : sbt -J-Xmx2G '++${{ matrix.scala }}' 'project /' githubWorkflowCheck
69
+ run : sbt -J-Xmx2G githubWorkflowCheck
70
70
71
71
- run : sbt -J-Xmx2G '++${{ matrix.scala }}' test mimaReportBinaryIssues
72
72
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
8
8
9
9
addSbtPlugin(" com.typesafe" % " sbt-mima-plugin" % " 1.1.0" )
10
10
11
- addSbtPlugin(" org.typelevel" % " sbt-typelevel-sonatype-ci-release" % " 0.5.0-M5 " )
11
+ addSbtPlugin(" org.typelevel" % " sbt-typelevel-sonatype-ci-release" % " 0.5.0-M6 " )
12
12
13
13
addSbtPlugin(" com.github.sbt" % " sbt-ci-release" % " 1.5.10" )
14
14
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .module .scala .deser
2
+
3
+ import com .fasterxml .jackson .databind .DeserializationFeature
4
+ import com .fasterxml .jackson .databind .exc .UnrecognizedPropertyException
5
+ import com .fasterxml .jackson .module .scala .deser .IgnorableFieldDeserializerTest .ExtractFields
6
+ import com .fasterxml .jackson .module .scala .{DefaultScalaModule , JacksonModule }
7
+
8
+ object IgnorableFieldDeserializerTest {
9
+ case class ExtractFields (s : String , i : Int )
10
+ }
11
+
12
+ class IgnorableFieldDeserializerTest extends DeserializerTest {
13
+
14
+ lazy val module : JacksonModule = DefaultScalaModule
15
+
16
+ " An ObjectMapper with the DefaultScalaModule" should " fail if field is not expected" in {
17
+ val mapper = newMapper
18
+ intercept[UnrecognizedPropertyException ] {
19
+ mapper.readValue(genJson(100 ), classOf [ExtractFields ])
20
+ }
21
+ }
22
+
23
+ it should " succeed if field is not expected" in {
24
+ val mapper = newBuilder
25
+ .disable(DeserializationFeature .FAIL_ON_UNKNOWN_PROPERTIES )
26
+ .build()
27
+ val ef = mapper.readValue(genJson(1000 ), classOf [ExtractFields ])
28
+ ef.s shouldEqual " s"
29
+ ef.i shouldEqual 1
30
+ }
31
+
32
+ private def genJson (size : Int ): String = {
33
+ s """ {"s":"s","n": ${" 7" * size},"i":1} """
34
+ }
35
+
36
+ }
You can’t perform that action at this time.
0 commit comments