Search in sources :

Example 1 with Db1DeepPartialObject

use of org.simpleflatmapper.test.beans.Db1DeepPartialObject in project SimpleFlatMapper by arnaudroger.

the class CsvMapperBuilderSubObjectTest method testMapDbPartialObject.

@Test
public void testMapDbPartialObject() throws UnsupportedEncodingException, Exception {
    CsvMapperBuilder<Db1DeepPartialObject> builder = new CsvMapperBuilder<Db1DeepPartialObject>(Db1DeepPartialObject.class);
    addDbObjectFields(builder);
    CsvMapper<Db1DeepPartialObject> mapper = builder.mapper();
    List<Db1DeepPartialObject> list = mapper.forEach(db1deepObjectCsvReader(), new ListCollector<Db1DeepPartialObject>()).getList();
    assertEquals(1, list.size());
    Db1DeepPartialObject o = list.get(0);
    assertEquals(1234, o.getId());
    assertEquals("val!", o.getValue());
    DbHelper.assertDbObjectMapping(o.getDbObject());
}
Also used : Db1DeepPartialObject(org.simpleflatmapper.test.beans.Db1DeepPartialObject) ListCollector(org.simpleflatmapper.util.ListCollector) CsvMapperBuilder(org.simpleflatmapper.csv.CsvMapperBuilder) Test(org.junit.Test)

Example 2 with Db1DeepPartialObject

use of org.simpleflatmapper.test.beans.Db1DeepPartialObject in project SimpleFlatMapper by arnaudroger.

the class CsvMapperBuilderSubObjectTest method testMapDbPartialObjectNoAsm.

@Test
public void testMapDbPartialObjectNoAsm() throws UnsupportedEncodingException, Exception {
    CsvMapperBuilder<Db1DeepPartialObject> builder = new CsvMapperBuilder<Db1DeepPartialObject>(Db1DeepPartialObject.class, ReflectionService.disableAsm());
    addDbObjectFields(builder);
    CsvMapper<Db1DeepPartialObject> mapper = builder.mapper();
    List<Db1DeepPartialObject> list = mapper.forEach(db1deepObjectCsvReader(), new ListCollector<Db1DeepPartialObject>()).getList();
    assertEquals(1, list.size());
    Db1DeepPartialObject o = list.get(0);
    assertEquals(1234, o.getId());
    assertEquals("val!", o.getValue());
    DbHelper.assertDbObjectMapping(o.getDbObject());
}
Also used : Db1DeepPartialObject(org.simpleflatmapper.test.beans.Db1DeepPartialObject) ListCollector(org.simpleflatmapper.util.ListCollector) CsvMapperBuilder(org.simpleflatmapper.csv.CsvMapperBuilder) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 CsvMapperBuilder (org.simpleflatmapper.csv.CsvMapperBuilder)2 Db1DeepPartialObject (org.simpleflatmapper.test.beans.Db1DeepPartialObject)2 ListCollector (org.simpleflatmapper.util.ListCollector)2