Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.configuration.ConfigurationTest Class Referenceabstract
Inheritance diagram for org.bukkit.configuration.ConfigurationTest:
org.bukkit.configuration.MemoryConfigurationTest org.bukkit.configuration.file.FileConfigurationTest org.bukkit.configuration.file.YamlConfigurationTest

Public Member Functions

abstract Configuration getConfig ()
 
Map< String, Object > getTestValues ()
 
void testAddDefault ()
 
void testAddDefaults_Map ()
 
void testAddDefaults_Configuration ()
 
void testSetDefaults ()
 
void testCreateSection ()
 
void testGetDefaults ()
 

Detailed Description

Definition at line 13 of file ConfigurationTest.java.

Member Function Documentation

void org.bukkit.configuration.ConfigurationTest.testAddDefault ( )

Test of addDefault method, of class Configuration.

Definition at line 35 of file ConfigurationTest.java.

References org.bukkit.configuration.Configuration.addDefault(), org.bukkit.configuration.ConfigurationSection.contains(), org.bukkit.configuration.ConfigurationSection.get(), org.bukkit.configuration.Configuration.getDefaults(), and org.bukkit.configuration.ConfigurationSection.isSet().

35  {
36  Configuration config = getConfig();
37  Map<String, Object> values = getTestValues();
38 
39  for (Map.Entry<String, Object> entry : values.entrySet()) {
40  String path = entry.getKey();
41  Object object = entry.getValue();
42 
43  config.addDefault(path, object);
44 
45  assertEquals(object, config.get(path));
46  assertTrue(config.contains(path));
47  assertFalse(config.isSet(path));
48  assertTrue(config.getDefaults().isSet(path));
49  }
50  }
void org.bukkit.configuration.ConfigurationTest.testAddDefaults_Configuration ( )

Test of addDefaults method, of class Configuration.

Definition at line 77 of file ConfigurationTest.java.

References org.bukkit.configuration.Configuration.addDefaults(), org.bukkit.configuration.ConfigurationSection.contains(), org.bukkit.configuration.ConfigurationSection.get(), org.bukkit.configuration.Configuration.getDefaults(), org.bukkit.configuration.ConfigurationSection.isSet(), and org.bukkit.configuration.ConfigurationSection.set().

77  {
78  Configuration config = getConfig();
79  Map<String, Object> values = getTestValues();
80  Configuration defaults = getConfig();
81 
82  for (Map.Entry<String, Object> entry : values.entrySet()) {
83  defaults.set(entry.getKey(), entry.getValue());
84  }
85 
86  config.addDefaults(defaults);
87 
88  for (Map.Entry<String, Object> entry : values.entrySet()) {
89  String path = entry.getKey();
90  Object object = entry.getValue();
91 
92  assertEquals(object, config.get(path));
93  assertTrue(config.contains(path));
94  assertFalse(config.isSet(path));
95  assertTrue(config.getDefaults().isSet(path));
96  }
97  }
void org.bukkit.configuration.ConfigurationTest.testAddDefaults_Map ( )

Test of addDefaults method, of class Configuration.

Definition at line 56 of file ConfigurationTest.java.

References org.bukkit.configuration.Configuration.addDefaults(), org.bukkit.configuration.ConfigurationSection.contains(), org.bukkit.configuration.ConfigurationSection.get(), org.bukkit.configuration.Configuration.getDefaults(), and org.bukkit.configuration.ConfigurationSection.isSet().

56  {
57  Configuration config = getConfig();
58  Map<String, Object> values = getTestValues();
59 
60  config.addDefaults(values);
61 
62  for (Map.Entry<String, Object> entry : values.entrySet()) {
63  String path = entry.getKey();
64  Object object = entry.getValue();
65 
66  assertEquals(object, config.get(path));
67  assertTrue(config.contains(path));
68  assertFalse(config.isSet(path));
69  assertTrue(config.getDefaults().isSet(path));
70  }
71  }
void org.bukkit.configuration.ConfigurationTest.testCreateSection ( )

Test creation of ConfigurationSection

Definition at line 129 of file ConfigurationTest.java.

References org.bukkit.configuration.ConfigurationSection.createSection(), and org.bukkit.configuration.ConfigurationSection.getKeys().

129  {
130  Configuration config = getConfig();
131 
132  Set<String> set = new HashSet<String>();
133  set.add("this");
134  set.add("this.test.sub");
135  set.add("this.test");
136  set.add("this.test.other");
137 
138  config.createSection("this.test.sub");
139  config.createSection("this.test.other");
140 
141  assertEquals(set, config.getKeys(true));
142  }
void org.bukkit.configuration.ConfigurationTest.testGetDefaults ( )

Test of getDefaults method, of class Configuration.

Definition at line 148 of file ConfigurationTest.java.

References org.bukkit.configuration.Configuration.getDefaults(), and org.bukkit.configuration.Configuration.setDefaults().

148  {
149  Configuration config = getConfig();
150  Configuration defaults = getConfig();
151 
152  config.setDefaults(defaults);
153 
154  assertEquals(defaults, config.getDefaults());
155  }
void org.bukkit.configuration.ConfigurationTest.testSetDefaults ( )

Test of setDefaults method, of class Configuration.

Definition at line 103 of file ConfigurationTest.java.

References org.bukkit.configuration.ConfigurationSection.contains(), org.bukkit.configuration.ConfigurationSection.get(), org.bukkit.configuration.Configuration.getDefaults(), org.bukkit.configuration.ConfigurationSection.isSet(), org.bukkit.configuration.ConfigurationSection.set(), and org.bukkit.configuration.Configuration.setDefaults().

103  {
104  Configuration config = getConfig();
105  Map<String, Object> values = getTestValues();
106  Configuration defaults = getConfig();
107 
108  for (Map.Entry<String, Object> entry : values.entrySet()) {
109  defaults.set(entry.getKey(), entry.getValue());
110  }
111 
112  config.setDefaults(defaults);
113 
114  for (Map.Entry<String, Object> entry : values.entrySet()) {
115  String path = entry.getKey();
116  Object object = entry.getValue();
117 
118  assertEquals(object, config.get(path));
119  assertTrue(config.contains(path));
120  assertFalse(config.isSet(path));
121  assertTrue(config.getDefaults().isSet(path));
122  }
123  }

The documentation for this class was generated from the following file: