Search in sources :

Example 1 with PropertiesBean

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");
}
Also used : PropertiesBean(com.tvd12.properties.file.struct.PropertiesBean) BaseTest(com.tvd12.test.base.BaseTest) Test(org.testng.annotations.Test)

Example 2 with PropertiesBean

use of com.tvd12.properties.file.struct.PropertiesBean in project properties-file by tvd12.

the class PropertiesClassTest method main.

public static void main(String[] args) {
    PropertiesBean map = new PropertiesBean(ClassE.class);
    map.put("clazz", ClassA.class.toString());
}
Also used : PropertiesBean(com.tvd12.properties.file.struct.PropertiesBean)

Example 3 with PropertiesBean

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");
}
Also used : PropertyAnnotations(com.tvd12.properties.file.annotation.PropertyAnnotations) PropertiesBean(com.tvd12.properties.file.struct.PropertiesBean) Properties(java.util.Properties) Test(org.testng.annotations.Test)

Example 4 with PropertiesBean

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");
}
Also used : PropertiesBean(com.tvd12.properties.file.struct.PropertiesBean) Test(org.testng.annotations.Test)

Example 5 with PropertiesBean

use of com.tvd12.properties.file.struct.PropertiesBean in project properties-file by tvd12.

the class PropertiesClassTest method wrapperTest2.

@Test
public void wrapperTest2() {
    PropertiesBean map = new PropertiesBean(ClassC.class);
    map.put("length", 1);
    map.put("value", "zzz");
    map.put("value", "yyy");
    map.put("clazz", ClassA.class);
    map.put("classD", new ClassD(1));
}
Also used : PropertiesBean(com.tvd12.properties.file.struct.PropertiesBean) BaseTest(com.tvd12.test.base.BaseTest) Test(org.testng.annotations.Test)

Aggregations

PropertiesBean (com.tvd12.properties.file.struct.PropertiesBean)17 Test (org.testng.annotations.Test)15 BaseTest (com.tvd12.test.base.BaseTest)10 Properties (java.util.Properties)3 PropertyAnnotations (com.tvd12.properties.file.annotation.PropertyAnnotations)2