Search in sources :

Example 11 with ClassA

use of com.tvd12.ezyfoxserver.testing.jaxberror.ClassA in project properties-file by tvd12.

the class SetterMethodTest method test.

@Test
public void test() {
    Method method = MethodBuilder.create().clazz(ClassA.class).method("setName").argument(String.class).build();
    SetterMethod setterMethod = new SetterMethod(new PropertyAnnotations());
    setterMethod.initWithMethod(method);
    setterMethod.invoke(new ClassA(), "123");
}
Also used : PropertyAnnotations(com.tvd12.properties.file.annotation.PropertyAnnotations) SetterMethod(com.tvd12.properties.file.struct.SetterMethod) SetterMethod(com.tvd12.properties.file.struct.SetterMethod) Method(java.lang.reflect.Method) Test(org.testng.annotations.Test)

Example 12 with ClassA

use of com.tvd12.ezyfoxserver.testing.jaxberror.ClassA in project properties-file by tvd12.

the class PropertiesMapperTest method testMapPropertiesToBean.

@Test
public void testMapPropertiesToBean() {
    Properties properties = new Properties();
    properties.setProperty("name", "hello");
    properties.put("age", 24);
    properties.put("clazz", ClassA.class.getName());
    properties.put("date", new SimpleDateFormat(Dates.getPattern()).format(new Date()));
    ClassA object = new PropertiesMapper().data(properties).clazz(ClassA.class).map();
    assertEquals(object.getName(), "hello");
    assertEquals(object.getAge(), 24);
    assertEquals(object.getMoney(), 10);
    assertEquals(object.getClazz(), ClassA.class);
    assertNotNull(object.getDate());
}
Also used : PropertiesMapper(com.tvd12.properties.file.mapping.PropertiesMapper) Properties(java.util.Properties) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) Test(org.testng.annotations.Test)

Example 13 with ClassA

use of com.tvd12.ezyfoxserver.testing.jaxberror.ClassA in project properties-file by tvd12.

the class SetterMethodTest method test.

@Test
public void test() {
    Method method = MethodBuilder.create().clazz(ClassA.class).method("setName").argument(String.class).build();
    SetterMethod setterMethod = new SetterMethod(new PropertyAnnotations());
    setterMethod.initWithMethod(method);
    setterMethod.invoke(new ClassA(), "123");
}
Also used : PropertyAnnotations(com.tvd12.properties.file.annotation.PropertyAnnotations) SetterMethod(com.tvd12.properties.file.struct.SetterMethod) SetterMethod(com.tvd12.properties.file.struct.SetterMethod) Method(java.lang.reflect.Method) Test(org.testng.annotations.Test)

Example 14 with ClassA

use of com.tvd12.ezyfoxserver.testing.jaxberror.ClassA in project properties-file by tvd12.

the class SetterMethodTest method testInvalidCase.

@Test(expectedExceptions = { IllegalStateException.class })
public void testInvalidCase() {
    Method method = MethodBuilder.create().clazz(ClassA.class).method("setValues").argument(String.class).argument(String.class).build();
    SetterMethod setterMethod = new SetterMethod(new PropertyAnnotations());
    setterMethod.initWithMethod(method);
    setterMethod.invoke(new ClassA(), "123");
}
Also used : PropertyAnnotations(com.tvd12.properties.file.annotation.PropertyAnnotations) SetterMethod(com.tvd12.properties.file.struct.SetterMethod) SetterMethod(com.tvd12.properties.file.struct.SetterMethod) Method(java.lang.reflect.Method) Test(org.testng.annotations.Test)

Example 15 with ClassA

use of com.tvd12.ezyfoxserver.testing.jaxberror.ClassA in project calabash by youngmonkeys.

the class PrototypesTest method test.

@Test
public void test() {
    Prototypes prototypes = Prototypes.builder().addProxy(new ClassBProxy()).addProxy(new ClassAProxy()).build();
    ClassA origin = new ClassA();
    ClassA copy = prototypes.copy(origin);
    assert copy != origin;
}
Also used : Prototypes(com.tvd12.calabash.core.prototype.Prototypes) SimplePrototypes(com.tvd12.calabash.core.prototype.SimplePrototypes) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)15 Properties (java.util.Properties)10 PropertiesMapper (com.tvd12.properties.file.mapping.PropertiesMapper)8 SimpleDateFormat (java.text.SimpleDateFormat)8 Date (java.util.Date)8 PropertyAnnotations (com.tvd12.properties.file.annotation.PropertyAnnotations)6 SetterMethod (com.tvd12.properties.file.struct.SetterMethod)4 Method (java.lang.reflect.Method)4 PropertiesBean (com.tvd12.properties.file.struct.PropertiesBean)2 Prototypes (com.tvd12.calabash.core.prototype.Prototypes)1 SimplePrototypes (com.tvd12.calabash.core.prototype.SimplePrototypes)1