use of com.tvd12.properties.file.struct.PropertiesBean in project properties-file by tvd12.
the class PropertiesClassTest method transformClazzInvalidCaseTest.
@Test
public void transformClazzInvalidCaseTest() {
PropertiesBean map = new PropertiesBean(ClassE.class);
map.put("clazz", "classD");
}
use of com.tvd12.properties.file.struct.PropertiesBean in project properties-file by tvd12.
the class PropertiesBeanTest method bindFromEnv.
@Test
public void bindFromEnv() {
// given
PropertiesBean mapping = new PropertiesBean(ClassC.class);
// when
mapping.putAll(new Properties());
// then
System.out.println("ObjectC: " + mapping.getObject());
}
use of com.tvd12.properties.file.struct.PropertiesBean in project properties-file by tvd12.
the class PropertiesBeanTest method testParseDate.
@Test
public void testParseDate() {
PropertiesBean mapping = new PropertiesBean(ClassB.class);
mapping.put("date", "abc");
}
use of com.tvd12.properties.file.struct.PropertiesBean in project properties-file by tvd12.
the class PropertiesBeanTest method test.
@Test
public void test() {
new PropertiesBean(ClassA.class);
ClassA classA = new ClassA();
PropertiesBean mapping2 = new PropertiesBean(classA, new PropertyAnnotations());
mapping2.put("charValue", "c");
mapping2.put("byteValue", "1");
mapping2.put("doubleValue", "2.0");
mapping2.put("floatValue", "3.0");
mapping2.put("longValue", "4");
mapping2.put("shortValue", "5");
mapping2.put("not found", "not found");
assertEquals(classA.getCharValue(), 'c');
assertEquals(classA.getByteValue(), 1);
assertEquals(classA.getDoubleValue(), 2.0D);
assertEquals(classA.getFloatValue(), 3.0F);
assertEquals(classA.getLongValue(), 4);
assertEquals(classA.getShortValue(), 5);
Properties dataSourceProperties = new Properties();
dataSourceProperties.put("datasource.username", "hello");
dataSourceProperties.put("datasource.password", "world");
PropertiesBean mapping3 = new PropertiesBean(classA, new PropertyAnnotations());
mapping3.put("dataSourceConfig", null, dataSourceProperties);
assert classA.dataSourceConfig.username.equals("hello");
assert classA.dataSourceConfig.password.equals("world");
}
use of com.tvd12.properties.file.struct.PropertiesBean in project properties-file by tvd12.
the class PropertiesClassTest method transformInvalidCaseTest.
@Test
public void transformInvalidCaseTest() {
PropertiesBean map = new PropertiesBean(ClassC.class);
map.put("classD", "classD");
}
Aggregations