TomlParser implements ConfigParser<CommentedConfig> { @Override public CommentedConfig parse(Reader reader) { configWasEmpty = true; return parse(new ReaderInput(reader), TomlFormat.instance().createConfig(), ParsingMode.MERGE); }  @Override CommentedConfig parse(Reader reader); @Override void parse(Reader reader, Config destination, ParsingMode parsingMode); boolean isLenientWithSeparators(); TomlParser setLenientWithSeparators(boolean lenientSeparators); boolean isLenientWithBareKeys(); TomlParser setLenientWithBareKeys(boolean lenientBareKeys); TomlParser setInitialStringBuilderCapacity(int initialStringBuilderCapacity); TomlParser setInitialListCapacity(int initialListCapacity); @Override ConfigFormat<CommentedConfig> getFormat();  }
@Test public void readWriteReadAgain() { File file = new File("test.toml"); CommentedConfig parsed = new TomlParser().parse(file, FileNotFoundAction.THROW_ERROR); System.out.println("--- parsed --- \n" + parsed); System.out.println("--------------------------------------------"); assertNull(parsed.getComment("without_comment")); assertNotNull(parsed.getComment("with_comments")); assertTrue(parsed.getComment("with_comments").contains("\n")); assertEquals(TestEnum.A, parsed.getEnum("enum", TestEnum.class)); java.io.StringWriter sw = new StringWriter(); TomlWriter writer = new TomlWriter(); writer.write(parsed, sw); System.out.println("--- written --- \n" + sw); System.out.println("--------------------------------------------"); CommentedConfig reparsed = new TomlParser().parse(new StringReader(sw.toString())); System.out.println("--- reparsed --- \n" + reparsed); assertEquals(parsed, reparsed); }