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