use of com.alibaba.dubbo.common.model.Person in project dubbo by alibaba.
the class PojoUtilsTest method test_PojoArray.
@Test
public void test_PojoArray() throws Exception {
Person[] array = new Person[2];
array[0] = new Person();
{
Person person = new Person();
person.setName("xxxx");
array[1] = person;
}
assertArrayObject(array);
}
use of com.alibaba.dubbo.common.model.Person in project dubbo by alibaba.
the class PojoUtilsTest method testRealizeLinkedList.
@Test
public void testRealizeLinkedList() throws Exception {
LinkedList<Person> input = new LinkedList<Person>();
Person person = new Person();
person.setAge(37);
input.add(person);
Object obj = PojoUtils.generalize(input);
Assert.assertTrue(obj instanceof List);
Assert.assertTrue(input.get(0) instanceof Person);
Object output = PojoUtils.realize(obj, LinkedList.class);
Assert.assertTrue(output instanceof LinkedList);
}
use of com.alibaba.dubbo.common.model.Person in project dubbo by alibaba.
the class PojoUtilsTest method test_Map_List_pojo.
@Test
public void test_Map_List_pojo() throws Exception {
Map<String, List<Object>> map = new HashMap<String, List<Object>>();
List<Object> list = new ArrayList<Object>();
list.add(new Person());
list.add(new SerializablePerson());
map.put("k", list);
Object generalize = PojoUtils.generalize(map);
Object realize = PojoUtils.realize(generalize, Map.class);
assertEquals(map, realize);
}
Aggregations