@@ -35,17 +35,17 @@ class MergeTest extends DeserializerTest {
35
35
behavior of " The DefaultScalaModule when reading for updating"
36
36
37
37
it should " merge both lists" in {
38
- val typeReference = new TypeReference [ClassWithLists ] {}
39
- val initial = deserialize(classJson(firstListJson), typeReference )
40
- val result = updateValue(newMergeableScalaMapper, initial, typeReference , classJson(secondListJson))
38
+ val clazz = classOf [ClassWithLists ]
39
+ val initial = deserialize(classJson(firstListJson), clazz )
40
+ val result = updateValue(newMergeableScalaMapper, initial, clazz , classJson(secondListJson))
41
41
42
42
result shouldBe ClassWithLists (mergedList, mergedList)
43
43
}
44
44
45
45
it should " merge only the annotated list" in {
46
- val typeReference = new TypeReference [ClassWithLists ] {}
47
- val initial = deserialize(classJson(firstListJson), typeReference )
48
- val result = updateValue(newScalaMapper, initial, typeReference , classJson(secondListJson))
46
+ val clazz = classOf [ClassWithLists ]
47
+ val initial = deserialize(classJson(firstListJson), clazz )
48
+ val result = updateValue(newScalaMapper, initial, clazz , classJson(secondListJson))
49
49
50
50
result shouldBe ClassWithLists (secondList, mergedList)
51
51
}
@@ -120,8 +120,18 @@ class MergeTest extends DeserializerTest {
120
120
objectReaderFor(mapper, valueToUpdate, typeReference).readValue(src)
121
121
}
122
122
123
+ private def updateValue [T ](mapper : ObjectMapper , valueToUpdate : T ,
124
+ clazz : Class [T ], src : String ): T = {
125
+ objectReaderFor(mapper, valueToUpdate, clazz).readValue(src)
126
+ }
127
+
123
128
private def objectReaderFor [T ](mapper : ObjectMapper , valueToUpdate : T ,
124
129
typeReference : TypeReference [T ]): ObjectReader = {
125
130
mapper.readerForUpdating(valueToUpdate).forType(typeReference)
126
131
}
132
+
133
+ private def objectReaderFor [T ](mapper : ObjectMapper , valueToUpdate : T ,
134
+ clazz : Class [T ]): ObjectReader = {
135
+ mapper.readerForUpdating(valueToUpdate).forType(clazz)
136
+ }
127
137
}
0 commit comments