use of com.tvd12.properties.file.reader.BaseFileReader in project properties-file by tvd12.
the class V112PropertiesUtilTest method readVariableYamlFile.
@Test
public void readVariableYamlFile() {
// given
Map<Object, Object> properties = new BaseFileReader().read("v112_application.yaml");
// when
PropertiesUtil.setVariableValues(properties);
// then
Map<Object, Object> expectation = new HashMap<>();
expectation.put("app.hello", "world");
expectation.put("app.hi", "world");
Asserts.assertEquals(expectation, properties, false);
}
use of com.tvd12.properties.file.reader.BaseFileReader in project properties-file by tvd12.
the class V112PropertiesUtilTest method readVariablePropertiesFile.
@Test
public void readVariablePropertiesFile() {
// given
Map<Object, Object> properties = new BaseFileReader().read("v112_application.properties");
// when
PropertiesUtil.setVariableValues(properties);
// then
Map<Object, Object> expectation = new HashMap<>();
expectation.put("app.hello", "world");
expectation.put("app.hi", "world");
Asserts.assertEquals(expectation, properties, false);
}
use of com.tvd12.properties.file.reader.BaseFileReader in project properties-file by tvd12.
the class YamlFileReaderTest method testInvalidKey.
@Test(expectedExceptions = YamlInvalidSyntaxException.class)
public void testInvalidKey() {
BaseFileReader reader = new BaseFileReader();
reader.read("invalid_yaml5.txt");
}
use of com.tvd12.properties.file.reader.BaseFileReader in project properties-file by tvd12.
the class YamlFileReaderTest method readTabs.
@Test
public void readTabs() {
BaseFileReader reader = new BaseFileReader();
Properties properties = reader.read("application2_yaml.txt");
System.out.println(properties);
assert properties.get("cors.allow_origin").equals("*");
assert properties.get("cors.enable").equals("true");
assert properties.get("server.port").equals("3005");
assert properties.get("server.host").equals("0.0.0.0");
assert properties.get("server.admin.User-Name1").equals("admin");
assert properties.get("server.admin.password2").equals("123456");
assert properties.get("hello").equals("world");
assert properties.get("foo").equals("bar");
}
use of com.tvd12.properties.file.reader.BaseFileReader in project properties-file by tvd12.
the class YamlFileReaderTest method readInvalidYamlFileLastPropertyKeyIsNull.
@Test
public void readInvalidYamlFileLastPropertyKeyIsNull() {
// given
BaseFileReader sut = new BaseFileReader();
// when
Throwable e = Asserts.assertThrows(() -> sut.read("v112_application_invalid.yaml"));
// then
Asserts.assertEquals(YamlInvalidSyntaxException.class, e.getClass());
}
Aggregations