YamlConfiguration extends FileConfiguration { @Override public String saveToString() throws IOException { return this.buildHeader() + this.dump(); }  static YamlConfiguration loadConfiguration(final File file); static YamlConfiguration loadConfiguration(final InputStream stream); static YamlConfiguration loadConfiguration(final Reader reader); @Override String saveToString(); @Override void loadFromString(final String contents); @Override YamlConfigurationOptions options();  }
@Test void saveToString() throws IOException { final InputStreamOf stream = new InputStreamOf( new ResourceOf("test.yml")); final YamlConfiguration configuration = YamlConfiguration.loadConfiguration(stream); final String content = "test:\n" + " number: 5\n" + " string: Hello world\n" + " boolean: true\n" + " list:\n" + " - Each\n" + " - word\n" + " - will\n" + " - be\n" + " - in\n" + " - a\n" + " - separated\n" + " - entry\n" + "math:\n" + " pi: 3.141592653589793\n" + "timestamp:\n" + " canonicalDate: 2020-07-04T13:18:04.458Z\n" + " formattedDate: 04/07/2020 15:18:04\n"; MatcherAssert.assertThat( "Couldn't get the content of the file!", configuration.saveToString(), new IsEqual<>(content)); }