@@ -17,7 +17,7 @@ class MergeTest extends DeserializerTest {
1717
1818 val module : DefaultScalaModule .type = DefaultScalaModule
1919
20- // This test replies on enabling MapperFeature.ALLOW_FINAL_FIELDS_AS_MUTATORS
20+ // This test relies on enabling MapperFeature.ALLOW_FINAL_FIELDS_AS_MUTATORS
2121 // which is not enabled by default in the Jackson v2 but not in Jackson v3
2222 def newScalaMapper : ObjectMapper = newBuilder
2323 .enable(MapperFeature .ALLOW_FINAL_FIELDS_AS_MUTATORS )
@@ -28,6 +28,21 @@ class MergeTest extends DeserializerTest {
2828 .defaultMergeable(true )
2929 .build()
3030
31+ val firstListJson = """ ["one","two"]"""
32+ val secondListJson = """ ["three"]"""
33+ val secondList = List (" three" )
34+ val mergedList = List (" one" , " two" , " three" )
35+
36+ val firstStringMapJson = """ {"one":"1","two":"2"}"""
37+ val secondStringMapJson = """ {"two":"22","three":"33"}"""
38+ val secondStringMap = Map (" two" -> " 22" , " three" -> " 33" )
39+ val mergedStringMap = Map (" one" -> " 1" , " two" -> " 22" , " three" -> " 33" )
40+
41+ val firstPairMapJson = """ {"one":{"first":"1"},"two":{"second":"2"},"three":{"first":"3","second":"4"}}"""
42+ val secondPairMapJson = """ {"two":{"first":"22"},"three":{"second":"33"}}"""
43+ val secondPairMap = Map (" two" -> Pair (" 22" , null ), " three" -> Pair (null , " 33" ))
44+ val mergedPairMap = Map (" one" -> Pair (" 1" , null ), " two" -> Pair (" 22" , " 2" ), " three" -> Pair (" 3" , " 33" ))
45+
3146 behavior of " The DefaultScalaModule when reading for updating"
3247
3348 it should " merge both lists" in {
@@ -69,16 +84,7 @@ class MergeTest extends DeserializerTest {
6984
7085 result shouldBe ClassWithMaps (mergedPairMap, mergedPairMap)
7186 }
72-
73- // https://github.com/FasterXML/jackson-module-scala/issues/817
74- it should " merge only the annotated pair map" ignore {
75- val typeReference = new TypeReference [ClassWithMaps [Pair ]]{}
76- val initial = deserialize(classJson(firstPairMapJson), typeReference)
77- val result = updateValue(newScalaMapper, initial, typeReference, classJson(secondPairMapJson))
78-
79- result shouldBe ClassWithMaps (secondPairMap, mergedPairMap)
80- }
81-
87+
8288 it should " merge both mutable maps" in {
8389 val typeReference = new TypeReference [ClassWithMutableMaps [String ]]{}
8490 val initial = deserialize(classJson(firstStringMapJson), typeReference)
@@ -95,22 +101,7 @@ class MergeTest extends DeserializerTest {
95101 result shouldBe ClassWithMutableMaps (mutable.Map () ++ secondStringMap, mutable.Map () ++ mergedStringMap)
96102 }
97103
98- def classJson (nestedJson : String ) = s """ {"field1": $nestedJson,"field2": $nestedJson} """
99-
100- val firstListJson = """ ["one","two"]"""
101- val secondListJson = """ ["three"]"""
102- val secondList = List (" three" )
103- val mergedList = List (" one" , " two" , " three" )
104-
105- val firstStringMapJson = """ {"one":"1","two":"2"}"""
106- val secondStringMapJson = """ {"two":"22","three":"33"}"""
107- val secondStringMap = Map (" two" -> " 22" , " three" -> " 33" )
108- val mergedStringMap = Map (" one" -> " 1" , " two" -> " 22" , " three" -> " 33" )
109-
110- val firstPairMapJson = """ {"one":{"first":"1"},"two":{"second":"2"},"three":{"first":"3","second":"4"}}"""
111- val secondPairMapJson = """ {"two":{"first":"22"},"three":{"second":"33"}}"""
112- val secondPairMap = Map (" two" -> Pair (" 22" , null ), " three" -> Pair (null , " 33" ))
113- val mergedPairMap = Map (" one" -> Pair (" 1" , null ), " two" -> Pair (" 22" , " 2" ), " three" -> Pair (" 3" , " 33" ))
104+ private def classJson (nestedJson : String ) = s """ {"field1": $nestedJson,"field2": $nestedJson} """
114105
115106 private def updateValue [T ](mapper : ObjectMapper , valueToUpdate : T ,
116107 typeReference : TypeReference [T ], src : String ): T = {
0 commit comments