Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
YamlConfigurationTest.java
1 package org.bukkit.configuration.file;
2 
3 import org.junit.Test;
4 import static org.junit.Assert.*;
5 
7 
8  @Override
9  public YamlConfiguration getConfig() {
10  return new YamlConfiguration();
11  }
12 
13  @Override
14  public String getTestHeaderInput() {
15  return "This is a sample\nheader.\n\nNewline above should be commented.\n\n";
16  }
17 
18  @Override
19  public String getTestHeaderResult() {
20  return "# This is a sample\n# header.\n# \n# Newline above should be commented.\n\n";
21  }
22 
23  @Override
24  public String getTestValuesString() {
25  return "integer: -2147483648\n" +
26  "string: String Value\n" +
27  "long: 9223372036854775807\n" +
28  "true-boolean: true\n" +
29  "false-boolean: false\n" +
30  "vector:\n" +
31  " ==: Vector\n" +
32  " x: 12345.67\n" +
33  " y: 64.0\n" +
34  " z: -12345.6789\n" +
35  "list:\n" +
36  "- 1\n" +
37  "- 2\n" +
38  "- 3\n" +
39  "- 4\n" +
40  "- 5\n" +
41  "'42': The Answer\n";
42  }
43 
44  @Test
45  public void testSaveToStringWithIndent() {
46  YamlConfiguration config = getConfig();
47  config.options().indent(9);
48 
49  config.set("section.key", 1);
50 
51  String result = config.saveToString();
52  String expected = "section:\n key: 1\n";
53 
54  assertEquals(expected, result);
55  }
56 }
void set(String path, Object value)