File tree Expand file tree Collapse file tree
avro/src/test/java/tools/jackson/dataformat/avro Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -354,6 +354,14 @@ protected static String aposToQuotes(String json) {
354354 return json .replace ("'" , "\" " );
355355 }
356356
357+ protected static String asJSON (AvroSchema sch ) {
358+ return asJSON (sch .getAvroSchema ());
359+ }
360+
361+ protected static String asJSON (org .apache .avro .Schema avroSchema ) {
362+ return avroSchema .toString (true );
363+ }
364+
357365 /*
358366 /**********************************************************
359367 /* Text generation
Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ public void testClassEnumWithDefault() throws Exception
161161 AvroSchema schema = gen .getGeneratedSchema ();
162162 assertNotNull (schema );
163163
164- String json = schema . getAvroSchema (). toString ( true );
164+ String json = asJSON ( schema );
165165 assertNotNull (json );
166166
167167 // And read it back too just for fun
Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ public void testBasic() throws Exception
110110 AvroSchema schema = gen .getGeneratedSchema ();
111111 assertNotNull (schema );
112112
113- String json = schema . getAvroSchema (). toString ( true );
113+ String json = asJSON ( schema );
114114 assertNotNull (json );
115115
116116 // And read it back too just for fun
@@ -138,7 +138,7 @@ public void testEmployee() throws Exception
138138 AvroSchema schema = gen .getGeneratedSchema ();
139139 assertNotNull (schema );
140140
141- String json = schema . getAvroSchema (). toString ( true );
141+ String json = asJSON ( schema );
142142 assertNotNull (json );
143143 AvroSchema s2 = MAPPER .schemaFrom (json );
144144 assertNotNull (s2 );
@@ -170,7 +170,7 @@ public void testMap() throws Exception
170170 AvroSchema schema = gen .getGeneratedSchema ();
171171 assertNotNull (schema );
172172
173- String json = schema . getAvroSchema (). toString ( true );
173+ String json = asJSON ( schema );
174174 assertNotNull (json );
175175 AvroSchema s2 = MAPPER .schemaFrom (json );
176176 assertNotNull (s2 );
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ public void testEnumSchemaGeneration422() throws Exception
5757 MAPPER .acceptJsonFormatVisitor (Wrapper422 .class , gen );
5858
5959 org .apache .avro .Schema avroSchema = gen .getGeneratedSchema ().getAvroSchema ();
60- String avroSchemaInJSON = avroSchema . toString ( true );
60+ String avroSchemaInJSON = asJSON ( avroSchema );
6161 assertNotNull (avroSchemaInJSON );
6262 }
6363}
You can’t perform that action at this time.
0 commit comments