use of com.fasterxml.jackson.core.json.JsonFactory in project jackson-core by FasterXML.
the class TestPrettyPrinter method testCustomRootSeparatorWithFactory.
// Alternative solution for [jackson-core#26]
public void testCustomRootSeparatorWithFactory() throws Exception {
JsonFactory f = JsonFactory.builder().rootValueSeparator("##").build();
StringWriter sw = new StringWriter();
JsonGenerator gen = f.createGenerator(ObjectWriteContext.empty(), sw);
gen.writeNumber(13);
gen.writeBoolean(false);
gen.writeNull();
gen.close();
assertEquals("13##false##null", sw.toString());
}
use of com.fasterxml.jackson.core.json.JsonFactory in project jackson-core by FasterXML.
the class CommentParsingTest method testCCommentsChars.
public void testCCommentsChars() throws Exception {
JsonFactory f = JsonFactory.builder().enable(JsonParser.Feature.ALLOW_COMMENTS).build();
final String COMMENT = "/* foo */\n";
_testCommentsBeforePropValue(f, MODE_READER, COMMENT);
}
use of com.fasterxml.jackson.core.json.JsonFactory in project jackson-core by FasterXML.
the class CommentParsingTest method _createParser.
private JsonParser _createParser(String doc, int mode, boolean enabled) throws IOException {
JsonFactory f = JsonFactory.builder().configure(JsonParser.Feature.ALLOW_COMMENTS, enabled).build();
JsonParser p = createParser(f, mode, doc);
assertToken(JsonToken.START_ARRAY, p.nextToken());
return p;
}
use of com.fasterxml.jackson.core.json.JsonFactory in project jackson-core by FasterXML.
the class CommentParsingTest method testCppCommentsBytes.
public void testCppCommentsBytes() throws Exception {
JsonFactory f = JsonFactory.builder().enable(JsonParser.Feature.ALLOW_COMMENTS).build();
final String COMMENT = "// foo\n";
_testCommentsBeforePropValue(f, MODE_INPUT_STREAM, COMMENT);
_testCommentsBeforePropValue(f, MODE_INPUT_STREAM_THROTTLED, COMMENT);
_testCommentsBeforePropValue(f, MODE_DATA_INPUT, COMMENT);
}
use of com.fasterxml.jackson.core.json.JsonFactory in project jackson-core by FasterXML.
the class CommentParsingTest method testCCommentsBytes.
public void testCCommentsBytes() throws Exception {
JsonFactory f = JsonFactory.builder().enable(JsonParser.Feature.ALLOW_COMMENTS).build();
final String COMMENT = "/* foo */\n";
_testCommentsBeforePropValue(f, MODE_INPUT_STREAM, COMMENT);
_testCommentsBeforePropValue(f, MODE_INPUT_STREAM_THROTTLED, COMMENT);
_testCommentsBeforePropValue(f, MODE_DATA_INPUT, COMMENT);
}
Aggregations