use of com.alessiodp.core.common.configuration.ConfigOption in project Parties by AlessioDP.
the class BungeeConfigurationTest method testConfiguration.
private void testConfiguration(ConfigurationFile configurationFile, List<String> skipPaths) throws IllegalAccessException {
Field[] fields = configurationFile.getClass().getFields();
// Initialize YAML
YamlFile yf = YamlFile.loadConfiguration(new InputStreamReader(getClass().getResourceAsStream("/" + configurationFile.getResourceName())));
// Check fields
for (Field f : fields) {
ConfigOption co = f.getAnnotation(ConfigOption.class);
if (co != null && !skippablePath(co.path(), skipPaths)) {
Object value = yf.get(co.path());
assertNotNull(value, "The " + configurationFile.getClass().getSimpleName() + " path '" + co.path() + "' is null.");
f.set(null, value);
}
}
}
use of com.alessiodp.core.common.configuration.ConfigOption in project Parties by AlessioDP.
the class BukkitConfigurationTest method testConfiguration.
private void testConfiguration(ConfigurationFile configurationFile, List<String> skipPaths) throws IllegalAccessException {
Field[] fields = configurationFile.getClass().getFields();
// Initialize YAML
YamlFile yf = YamlFile.loadConfiguration(new InputStreamReader(getClass().getResourceAsStream("/" + configurationFile.getResourceName())));
// Check fields
for (Field f : fields) {
ConfigOption co = f.getAnnotation(ConfigOption.class);
if (co != null && !skippablePath(co.path(), skipPaths)) {
Object value = yf.get(co.path());
assertNotNull(value, "The " + configurationFile.getClass().getSimpleName() + " path '" + co.path() + "' is null.");
f.set(null, value);
}
}
}
use of com.alessiodp.core.common.configuration.ConfigOption in project Parties by AlessioDP.
the class VelocityConfigurationTest method testConfiguration.
private void testConfiguration(ConfigurationFile configurationFile, List<String> skipPaths) throws IllegalAccessException {
Field[] fields = configurationFile.getClass().getFields();
// Initialize YAML
YamlFile yf = YamlFile.loadConfiguration(new InputStreamReader(getClass().getResourceAsStream("/" + configurationFile.getResourceName())));
// Check fields
for (Field f : fields) {
ConfigOption co = f.getAnnotation(ConfigOption.class);
if (co != null && !skippablePath(co.path(), skipPaths)) {
Object value = yf.get(co.path());
assertNotNull(value, "The " + configurationFile.getClass().getSimpleName() + " path '" + co.path() + "' is null.");
f.set(null, value);
}
}
}
Aggregations