File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
cbor/src/test/java/com/fasterxml/jackson/dataformat/cbor/tofix Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .dataformat .cbor .tofix ;
2
+
3
+ import com .fasterxml .jackson .annotation .JsonIgnoreProperties ;
4
+
5
+ import com .fasterxml .jackson .databind .ObjectMapper ;
6
+
7
+ import com .fasterxml .jackson .dataformat .cbor .CBORGenerator ;
8
+ import com .fasterxml .jackson .dataformat .cbor .CBORTestBase ;
9
+ import com .fasterxml .jackson .dataformat .cbor .testutil .failure .JacksonTestFailureExpected ;
10
+
11
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
12
+
13
+ import org .junit .jupiter .api .Test ;
14
+
15
+ public class StringRef599Test extends CBORTestBase
16
+ {
17
+ static class AB599 {
18
+ public String a ;
19
+ public String b ;
20
+ }
21
+
22
+ @ JsonIgnoreProperties (ignoreUnknown = true )
23
+ static class B599 {
24
+ public String b ;
25
+ }
26
+
27
+ private final ObjectMapper MAPPER = cborMapper (cborFactoryBuilder ()
28
+ .enable (CBORGenerator .Feature .STRINGREF )
29
+ .build ());
30
+
31
+ // [dataformats-binary#599]
32
+ @ JacksonTestFailureExpected
33
+ @ Test
34
+ public void testStringRef () throws Exception
35
+ {
36
+ AB599 ab = new AB599 ();
37
+ ab .a = "foo" ;
38
+ // important: has to be same String value to use StringRef
39
+ ab .b = ab .a ;
40
+ byte [] cbor = MAPPER .writeValueAsBytes (ab );
41
+ B599 b = MAPPER .readValue (cbor , B599 .class );
42
+ assertEquals (ab .b , b .b );
43
+ }
44
+ }
You can’t perform that action at this time.
0 commit comments