File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
src/test-jdk17/java/com/fasterxml/jackson/databind/records Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -187,10 +187,11 @@ public void testDeserializeJsonRename() throws Exception {
187
187
*/
188
188
@ Test
189
189
public void testDeserializeHeaderInjectRecord_WillFail () throws Exception {
190
- MAPPER .setInjectableValues (new InjectableValues .Std ().addValue (String .class , "Bob" ));
190
+ ObjectReader reader = MAPPER .readerFor (RecordWithHeaderInject .class )
191
+ .with (new InjectableValues .Std ().addValue (String .class , "Bob" ));
191
192
192
193
try {
193
- MAPPER .readValue ("{\" id\" :123}" , RecordWithHeaderInject . class );
194
+ reader .readValue ("{\" id\" :123}" );
194
195
195
196
fail ("should not pass" );
196
197
} catch (IllegalArgumentException e ) {
@@ -201,9 +202,9 @@ public void testDeserializeHeaderInjectRecord_WillFail() throws Exception {
201
202
202
203
@ Test
203
204
public void testDeserializeConstructorInjectRecord () throws Exception {
204
- MAPPER .setInjectableValues ( new InjectableValues . Std (). addValue ( String . class , "Bob" ));
205
-
206
- RecordWithConstructorInject value = MAPPER .readValue ("{\" id\" :123}" , RecordWithConstructorInject . class );
205
+ ObjectReader reader = MAPPER .readerFor ( RecordWithConstructorInject . class )
206
+ . with ( new InjectableValues . Std (). addValue ( String . class , "Bob" ));
207
+ RecordWithConstructorInject value = reader .readValue ("{\" id\" :123}" );
207
208
assertEquals (new RecordWithConstructorInject (123 , "Bob" ), value );
208
209
}
209
210
You can’t perform that action at this time.
0 commit comments