use of org.simpleflatmapper.test.beans.DbFinal1DeepObject in project SimpleFlatMapper by arnaudroger.
the class CsvMapperBuilderSubObjectTest method testMapDbFinalObject.
@Test
public void testMapDbFinalObject() throws Exception {
CsvMapperBuilder<DbFinal1DeepObject> builder = new CsvMapperBuilder<DbFinal1DeepObject>(DbFinal1DeepObject.class);
addDbObjectFields(builder);
CsvMapper<DbFinal1DeepObject> mapper = builder.mapper();
List<DbFinal1DeepObject> list = mapper.forEach(db1deepObjectCsvReader(), new ListCollector<DbFinal1DeepObject>()).getList();
assertEquals(1, list.size());
DbFinal1DeepObject o = list.get(0);
assertEquals(1234, o.getId());
assertEquals("val!", o.getValue());
DbHelper.assertDbObjectMapping(o.getDbObject());
}
use of org.simpleflatmapper.test.beans.DbFinal1DeepObject in project SimpleFlatMapper by arnaudroger.
the class AbstractMapperBuilderTest method testDbFinal1DeepObject.
@Test
public void testDbFinal1DeepObject() throws Exception {
ClassMeta<DbFinal1DeepObject> classMeta = ReflectionService.newInstance().<DbFinal1DeepObject>getClassMeta(DbFinal1DeepObject.class);
Mapper<Object[], DbFinal1DeepObject> mapper = new SampleMapperBuilder<DbFinal1DeepObject>(classMeta).addMapping("id").addMapping("value").addMapping("dbObject_id").addMapping("dbObject_name").mapper();
DbFinal1DeepObject map = mapper.map(new Object[] { 1, "vvv", 2l, "wwww" });
assertEquals(1, map.getId());
assertEquals("vvv", map.getValue());
assertEquals(2l, map.getDbObject().getId());
assertEquals("wwww", map.getDbObject().getName());
}
Aggregations