@@ -65,9 +65,8 @@ public void testStreamingNested() throws Exception
65
65
BufferedReader br = new BufferedReader (new StringReader (yaml ));
66
66
assertEquals ("ob:" , br .readLine ());
67
67
68
- /* 27-Jan-2015, tatu: Not 100% if those items ought to (or not) be indented.
69
- * SnakeYAML doesn't do that; yet some libs expect it. Strange.
70
- */
68
+ // 27-Jan-2015, tatu: Not 100% if those items ought to (or not) be indented.
69
+ // SnakeYAML doesn't do that; yet some libs expect it. Strange.
71
70
assertEquals ("- \" a\" " , br .readLine ());
72
71
assertEquals ("- \" b\" " , br .readLine ());
73
72
assertNull (br .readLine ());
@@ -164,173 +163,6 @@ public void testStartMarker() throws Exception
164
163
assertEquals ("name: \" Brad\" \n age: 39" , yaml );
165
164
}
166
165
167
- public void testSplitLines () throws Exception
168
- {
169
- final String TEXT = "1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890" ;
170
- final String [] INPUT = new String [] { TEXT };
171
- YAMLFactory f = new YAMLFactory ();
172
-
173
- // verify default settings
174
- assertTrue (f .isEnabled (YAMLGenerator .Feature .SPLIT_LINES ));
175
-
176
- // and first write with splitting enabled
177
- YAMLMapper mapper = new YAMLMapper (f );
178
- String yaml = mapper .writeValueAsString (INPUT ).trim ();
179
-
180
- assertEquals ("---\n " +
181
- "- \" 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890\\ \n " +
182
- " \\ 1234567890\" " ,
183
- yaml );
184
-
185
- // and then with splitting disabled
186
- f .disable (YAMLGenerator .Feature .SPLIT_LINES );
187
-
188
- yaml = mapper .writeValueAsString (INPUT ).trim ();
189
- assertEquals ("---\n " +
190
- "- \" 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890\" " ,
191
- yaml );
192
- }
193
-
194
- public void testLiteralStringsSingleLine () throws Exception
195
- {
196
- YAMLFactory f = new YAMLFactory ();
197
- // verify default settings
198
- assertFalse (f .isEnabled (YAMLGenerator .Feature .MINIMIZE_QUOTES ));
199
-
200
- f .configure (YAMLGenerator .Feature .MINIMIZE_QUOTES , true );
201
-
202
- YAMLMapper mapper = new YAMLMapper (f );
203
-
204
- Map <String , Object > content = new HashMap <String , Object >();
205
- content .put ("key" , "some value" );
206
- String yaml = mapper .writeValueAsString (content ).trim ();
207
-
208
- assertEquals ("---\n " +
209
- "key: some value" , yaml );
210
- }
211
-
212
- public void testMinimizeQuotesWithBooleanContent () throws Exception
213
- {
214
- YAMLFactory f = new YAMLFactory ();
215
- f .configure (YAMLGenerator .Feature .MINIMIZE_QUOTES , true );
216
-
217
- YAMLMapper mapper = new YAMLMapper (f );
218
-
219
- Map <String , Object > content = new HashMap <String , Object >();
220
- content .put ("key" , "true" );
221
- String yaml = mapper .writeValueAsString (content ).trim ();
222
-
223
- assertEquals ("---\n " +
224
- "key: \" true\" " , yaml );
225
-
226
- content .clear ();
227
- content .put ("key" , "false" );
228
- yaml = mapper .writeValueAsString (content ).trim ();
229
-
230
- assertEquals ("---\n " +
231
- "key: \" false\" " , yaml );
232
-
233
- content .clear ();
234
- content .put ("key" , "something else" );
235
- yaml = mapper .writeValueAsString (content ).trim ();
236
-
237
- assertEquals ("---\n " +
238
- "key: something else" , yaml );
239
-
240
- content .clear ();
241
- content .put ("key" , Boolean .TRUE );
242
- yaml = mapper .writeValueAsString (content ).trim ();
243
-
244
- assertEquals ("---\n " +
245
- "key: true" , yaml );
246
-
247
- }
248
-
249
- public void testLiteralStringsMultiLine () throws Exception
250
- {
251
- YAMLFactory f = new YAMLFactory ();
252
- // verify default settings
253
- assertFalse (f .isEnabled (YAMLGenerator .Feature .MINIMIZE_QUOTES ));
254
-
255
- f .configure (YAMLGenerator .Feature .MINIMIZE_QUOTES , true );
256
-
257
- YAMLMapper mapper = new YAMLMapper (f );
258
-
259
- Map <String , Object > content = new HashMap <String , Object >();
260
- content .put ("key" , "first\n second\n third" );
261
- String yaml = mapper .writeValueAsString (content ).trim ();
262
-
263
- assertEquals ("---\n " +
264
- "key: |-\n first\n second\n third" , yaml );
265
- }
266
-
267
- public void testQuoteNumberStoredAsString () throws Exception
268
- {
269
- YAMLFactory f = new YAMLFactory ();
270
- // verify default settings
271
- assertFalse (f .isEnabled (YAMLGenerator .Feature .MINIMIZE_QUOTES ));
272
- assertFalse (f .isEnabled (YAMLGenerator .Feature .ALWAYS_QUOTE_NUMBERS_AS_STRINGS ));
273
-
274
- f .configure (YAMLGenerator .Feature .MINIMIZE_QUOTES , true );
275
- f .configure (YAMLGenerator .Feature .ALWAYS_QUOTE_NUMBERS_AS_STRINGS , true );
276
-
277
- YAMLMapper mapper = new YAMLMapper (f );
278
-
279
- Map <String , Object > content = new HashMap <String , Object >();
280
- content .put ("key" , "20" );
281
- String yaml = mapper .writeValueAsString (content ).trim ();
282
-
283
- assertEquals ("---\n " +
284
- "key: \" 20\" " , yaml );
285
-
286
- content .clear ();
287
- content .put ("key" , "2.0" );
288
- yaml = mapper .writeValueAsString (content ).trim ();
289
-
290
- assertEquals ("---\n " +
291
- "key: \" 2.0\" " , yaml );
292
-
293
- content .clear ();
294
- content .put ("key" , "2.0.1.2.3" );
295
- yaml = mapper .writeValueAsString (content ).trim ();
296
-
297
- assertEquals ("---\n " +
298
- "key: 2.0.1.2.3" , yaml );
299
- }
300
-
301
- public void testNonQuoteNumberStoredAsString () throws Exception
302
- {
303
- YAMLFactory f = new YAMLFactory ();
304
- // verify default settings
305
- assertFalse (f .isEnabled (YAMLGenerator .Feature .MINIMIZE_QUOTES ));
306
- assertFalse (f .isEnabled (YAMLGenerator .Feature .ALWAYS_QUOTE_NUMBERS_AS_STRINGS ));
307
-
308
- f .configure (YAMLGenerator .Feature .MINIMIZE_QUOTES , true );
309
-
310
- YAMLMapper mapper = new YAMLMapper (f );
311
-
312
- Map <String , Object > content = new HashMap <String , Object >();
313
- content .put ("key" , "20" );
314
- String yaml = mapper .writeValueAsString (content ).trim ();
315
-
316
- assertEquals ("---\n " +
317
- "key: 20" , yaml );
318
-
319
- content .clear ();
320
- content .put ("key" , "2.0" );
321
- yaml = mapper .writeValueAsString (content ).trim ();
322
-
323
- assertEquals ("---\n " +
324
- "key: 2.0" , yaml );
325
-
326
- content .clear ();
327
- content .put ("key" , "2.0.1.2.3" );
328
- yaml = mapper .writeValueAsString (content ).trim ();
329
-
330
- assertEquals ("---\n " +
331
- "key: 2.0.1.2.3" , yaml );
332
- }
333
-
334
166
public void testLiteralBlockStyle () throws Exception
335
167
{
336
168
YAMLFactory f = new YAMLFactory ();
@@ -362,8 +194,7 @@ public void testLiteralBlockStyle() throws Exception
362
194
/**********************************************************************
363
195
*/
364
196
365
-
366
- protected void _writeBradDoc (JsonGenerator gen ) throws IOException
197
+ private void _writeBradDoc (JsonGenerator gen ) throws IOException
367
198
{
368
199
gen .writeStartObject ();
369
200
gen .writeStringField ("name" , "Brad" );
0 commit comments