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 {
187187 */
188188 @ Test
189189 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" ));
191192
192193 try {
193- MAPPER .readValue ("{\" id\" :123}" , RecordWithHeaderInject . class );
194+ reader .readValue ("{\" id\" :123}" );
194195
195196 fail ("should not pass" );
196197 } catch (IllegalArgumentException e ) {
@@ -201,9 +202,9 @@ public void testDeserializeHeaderInjectRecord_WillFail() throws Exception {
201202
202203 @ Test
203204 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}" );
207208 assertEquals (new RecordWithConstructorInject (123 , "Bob" ), value );
208209 }
209210
You can’t perform that action at this time.
0 commit comments