use of org.simpleflatmapper.csv.CsvMapperBuilder in project SimpleFlatMapper by arnaudroger.
the class CsvMapperImplTest method testStringRoot.
@Test
public void testStringRoot() throws IOException {
CsvMapperBuilder<String> builder = new CsvMapperBuilder<String>(String.class);
builder.addMapping("c1");
CsvMapper<String> mapper = builder.mapper();
assertEquals("0", mapper.iterator(new StringReader("0")).next());
}
use of org.simpleflatmapper.csv.CsvMapperBuilder 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());
}
use of org.simpleflatmapper.csv.CsvMapperBuilder in project SimpleFlatMapper by arnaudroger.
the class CsvMapperBuilderSubObjectTest method testMapDbObject.
@Test
public void testMapDbObject() throws Exception {
CsvMapperBuilder<Db1DeepObject> builder = new CsvMapperBuilder<Db1DeepObject>(Db1DeepObject.class, ReflectionService.newInstance(false));
addDbObjectFields(builder);
CsvMapper<Db1DeepObject> mapper = builder.mapper();
List<Db1DeepObject> list = mapper.forEach(db1deepObjectCsvReader(), new ListCollector<Db1DeepObject>()).getList();
assertEquals(1, list.size());
Db1DeepObject o = list.get(0);
assertEquals(1234, o.getId());
assertEquals("val!", o.getValue());
DbHelper.assertDbObjectMapping(o.getDbObject());
}
use of org.simpleflatmapper.csv.CsvMapperBuilder 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());
}
use of org.simpleflatmapper.csv.CsvMapperBuilder in project SimpleFlatMapper by arnaudroger.
the class CsvMapperImplTest method testEnumRoot.
@Test
public void testEnumRoot() throws IOException {
CsvMapperBuilder<TypeRoot> builder = new CsvMapperBuilder<TypeRoot>(TypeRoot.class);
builder.addMapping("c1");
CsvMapper<TypeRoot> mapper = builder.mapper();
assertEquals(TypeRoot.type1, mapper.iterator(new StringReader("0")).next());
}
Aggregations