@Test void shouldSerializeToJSON() { MutableTomlTable table = new MutableTomlTable(); table.set("bar", "one", positionAt(2, 1)); table.set("foo.baz", "two", positionAt(3, 2)); table.set("foo.buz", MutableTomlArray.EMPTY, positionAt(3, 2)); table.set("foo.foo", MutableTomlTable.EMPTY, positionAt(3, 2)); MutableTomlArray array = new MutableTomlArray(); array.append("hello\nthere", positionAt(5, 2)); array.append("goodbye", positionAt(5, 2)); table.set("foo.blah", array, positionAt(5, 2)); table.set("buz", OffsetDateTime.parse("1937-07-18T03:25:43-04:00"), positionAt(5, 2)); table.set("glad", LocalDateTime.parse("1937-07-18T03:25:43"), positionAt(5, 2)); table.set("zoo", LocalDate.parse("1937-07-18"), positionAt(5, 2)); table.set("alpha", LocalTime.parse("03:25:43"), positionAt(5, 2)); String expected = "{\n" + " \"alpha\" : \"03:25:43\",\n" + " \"bar\" : \"one\",\n" + " \"buz\" : \"1937-07-18T03:25:43-04:00\",\n" + " \"foo\" : {\n" + " \"baz\" : \"two\",\n" + " \"blah\" : [\n" + " \"hello\\nthere\",\n" + " \"goodbye\"\n" + " ],\n" + " \"buz\" : [],\n" + " \"foo\" : {}\n" + " },\n" + " \"glad\" : \"1937-07-18T03:25:43\",\n" + " \"zoo\" : \"1937-07-18\"\n" + "}\n"; assertEquals(expected.replace("\n", System.lineSeparator()), table.toJson()); }
MutableTomlTable set(String keyPath, Object value, TomlPosition position) { return set(parseDottedKey(keyPath), value, position); }
MutableTomlTable implements TomlTable { MutableTomlTable set(String keyPath, Object value, TomlPosition position) { return set(parseDottedKey(keyPath), value, position); } }
MutableTomlTable implements TomlTable { MutableTomlTable set(String keyPath, Object value, TomlPosition position) { return set(parseDottedKey(keyPath), value, position); } MutableTomlTable(); private  MutableTomlTable(boolean implicitlyDefined); }
MutableTomlTable implements TomlTable { MutableTomlTable set(String keyPath, Object value, TomlPosition position) { return set(parseDottedKey(keyPath), value, position); } MutableTomlTable(); private  MutableTomlTable(boolean implicitlyDefined); @Override int size(); @Override boolean isEmpty(); @Override Set<String> keySet(); @Override Set<List<String>> keyPathSet(boolean includeTables); @Override @Nullable @SuppressWarnings("unchecked") Object get(List<String> path); @Override @Nullable TomlPosition inputPositionOf(List<String> path); @Override Map<String, Object> toMap(); }
MutableTomlTable implements TomlTable { MutableTomlTable set(String keyPath, Object value, TomlPosition position) { return set(parseDottedKey(keyPath), value, position); } MutableTomlTable(); private  MutableTomlTable(boolean implicitlyDefined); @Override int size(); @Override boolean isEmpty(); @Override Set<String> keySet(); @Override Set<List<String>> keyPathSet(boolean includeTables); @Override @Nullable @SuppressWarnings("unchecked") Object get(List<String> path); @Override @Nullable TomlPosition inputPositionOf(List<String> path); @Override Map<String, Object> toMap();  }