File tree 1 file changed +25
-0
lines changed
yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/deser
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import com .fasterxml .jackson .core .JsonParser ;
4
4
import com .fasterxml .jackson .core .JsonToken ;
5
+ import com .fasterxml .jackson .databind .ObjectMapper ;
5
6
import com .fasterxml .jackson .dataformat .yaml .ModuleTestBase ;
6
7
import com .fasterxml .jackson .dataformat .yaml .YAMLFactory ;
7
8
import com .fasterxml .jackson .dataformat .yaml .YAMLParser ;
@@ -299,6 +300,15 @@ public void testIntParsingUnderscoresSm() throws Exception
299
300
p .close ();
300
301
}
301
302
303
+ public void testYamlLongWithUnderscores () throws Exception
304
+ {
305
+ ObjectMapper mapper = new ObjectMapper (new YAMLFactory ());
306
+ LongHolder longHolder = mapper .readValue ("v: 1_000_000" , LongHolder .class );
307
+ assertNotNull (longHolder );
308
+ assertEquals (LongHolder .class , longHolder .getClass ());
309
+ assertEquals (Long .valueOf (1000000 ), longHolder .getV ());
310
+ }
311
+
302
312
// [cbor#4]: accidental recognition as double, with multiple dots
303
313
public void testDoubleParsing () throws Exception
304
314
{
@@ -571,4 +581,19 @@ public void testTimeLikeValues() throws Exception
571
581
assertNull (p .nextToken ());
572
582
p .close ();
573
583
}
584
+
585
+ static class LongHolder
586
+ {
587
+ private Long v ;
588
+
589
+ public Long getV ()
590
+ {
591
+ return v ;
592
+ }
593
+
594
+ public void setV (Long v )
595
+ {
596
+ this .v = v ;
597
+ }
598
+ }
574
599
}
You can’t perform that action at this time.
0 commit comments