File tree 2 files changed +36
-3
lines changed
main/java/com/fasterxml/jackson/dataformat/ion
test/java/com/fasterxml/jackson/dataformat/ion/failing
2 files changed +36
-3
lines changed Original file line number Diff line number Diff line change @@ -286,9 +286,7 @@ public void annotateNextValue(String annotation) {
286
286
_writer .addTypeAnnotation (annotation );
287
287
}
288
288
289
- /* Ion Exentions
290
- *
291
- */
289
+ // // // Ion Extensions
292
290
293
291
public void writeDate (Calendar value ) throws JsonGenerationException , IOException {
294
292
_verifyValueWrite ("write date value" );
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .dataformat .ion .failing ;
2
+
3
+ import org .junit .Assert ;
4
+ import org .junit .Test ;
5
+
6
+ import com .fasterxml .jackson .annotation .JsonPropertyOrder ;
7
+ import com .fasterxml .jackson .dataformat .ion .IonFactory ;
8
+ import com .fasterxml .jackson .dataformat .ion .IonObjectMapper ;
9
+
10
+ // For [dataformats-binary#245]: no pretty-printing for textual format
11
+ public class PrettyPrintWriteTest
12
+ {
13
+ @ JsonPropertyOrder ({ "x" , "y" })
14
+ static class Point {
15
+ public int x = 1 ;
16
+ public int y = 2 ;
17
+ }
18
+
19
+ @ Test
20
+ public void testBasicPrettyPrintTextual () throws Exception
21
+ {
22
+ IonObjectMapper mapper = IonObjectMapper .builder (IonFactory .forTextualWriters ()).build ();
23
+ Assert .assertEquals ("{\n x:1,\n y:2\n }" ,
24
+ mapper .writerWithDefaultPrettyPrinter ().writeValueAsString (new Point ()));
25
+ }
26
+
27
+ // and with binary format, should simply be no-op
28
+ @ Test
29
+ public void testIgnorePrettyPrintForBinary () throws Exception
30
+ {
31
+ IonObjectMapper mapper = IonObjectMapper .builder (IonFactory .forBinaryWriters ()).build ();
32
+ byte [] encoded = mapper .writerWithDefaultPrettyPrinter ().writeValueAsBytes (new Point ());
33
+ Assert .assertNotNull (encoded );
34
+ }
35
+ }
You can’t perform that action at this time.
0 commit comments