22
33import java .io .ByteArrayOutputStream ;
44
5+ import org .junit .jupiter .api .Test ;
6+
57import tools .jackson .core .FormatSchema ;
68import tools .jackson .core .StreamReadCapability ;
79import tools .jackson .core .StreamWriteFeature ;
@@ -28,6 +30,7 @@ public String getSchemaType() {
2830 /**********************************************************************
2931 */
3032
33+ @ Test
3134 public void testFactoryDefaults () throws Exception
3235 {
3336 assertTrue (MAPPER .tokenStreamFactory ().isEnabled (AvroReadFeature .AVRO_BUFFERING ));
@@ -38,25 +41,29 @@ public void testFactoryDefaults() throws Exception
3841 assertFalse (MAPPER .tokenStreamFactory ().canUseSchema (BOGUS_SCHEMA ));
3942 }
4043
44+ @ Test
4145 public void testParserDefaults () throws Exception
4246 {
43- AvroParser p = (AvroParser ) MAPPER .createParser (new byte [0 ]);
44- assertTrue (p .isEnabled (AvroReadFeature .AVRO_BUFFERING ));
45- p . close ();
47+ try ( AvroParser p = (AvroParser ) MAPPER .createParser (new byte [0 ])) {
48+ assertTrue (p .isEnabled (AvroReadFeature .AVRO_BUFFERING ));
49+ }
4650
4751 AvroMapper mapper = AvroMapper .builder ()
4852 .disable (AvroReadFeature .AVRO_BUFFERING )
4953 .build ();
50- p = (AvroParser ) mapper .createParser (new byte [0 ]);
51- assertFalse (p .isEnabled (AvroReadFeature .AVRO_BUFFERING ));
52-
53- // 15-Jan-2021, tatu: 2.14 added this setting, not enabled in
54- // default set
55- assertTrue (p .streamReadCapabilities ().isEnabled (StreamReadCapability .EXACT_FLOATS ));
54+ try (AvroParser p = (AvroParser ) mapper .createParser (new byte [0 ])) {
55+ assertFalse (p .isEnabled (AvroReadFeature .AVRO_BUFFERING ));
56+
57+ // 15-Jan-2021, tatu: 2.14 added this setting, not enabled in
58+ // default set
59+ assertTrue (p .streamReadCapabilities ().isEnabled (StreamReadCapability .EXACT_FLOATS ));
60+ }
5661
57- p .close ();
58- }
62+ // [dataformats-binary#619]
63+ assertTrue (MAPPER .isEnabled (AvroReadFeature .AVRO_BUFFERING ));
64+ }
5965
66+ @ Test
6067 public void testGeneratorDefaults () throws Exception
6168 {
6269 ByteArrayOutputStream bytes = new ByteArrayOutputStream ();
@@ -76,6 +83,9 @@ public void testGeneratorDefaults() throws Exception
7683 .createGenerator (bytes );
7784 assertFalse (g .isEnabled (AvroWriteFeature .AVRO_BUFFERING ));
7885 g .close ();
86+
87+ // [dataformats-binary#619]
88+ assertFalse (MAPPER .isEnabled (AvroWriteFeature .AVRO_FILE_OUTPUT ));
7989 }
8090
8191 /*
@@ -84,6 +94,7 @@ public void testGeneratorDefaults() throws Exception
8494 /**********************************************************************
8595 */
8696
97+ @ Test
8798 public void testDefaultSettingsWithAvroMapper ()
8899 {
89100 AvroMapper mapper = new AvroMapper ();
0 commit comments