use of org.simpleflatmapper.map.mapper.MapperImpl in project SimpleFlatMapper by arnaudroger.
the class JdbcMapperErrorTest method testInstantiatorError.
@Test
public void testInstantiatorError() {
MapperImpl<ResultSet, DbObject> mapper = new MapperImpl<ResultSet, DbObject>(null, null, new BiInstantiator<ResultSet, MappingContext<? super ResultSet>, DbObject>() {
@Override
public DbObject newInstance(ResultSet s, MappingContext<? super ResultSet> context) throws Exception {
throw new IOException();
}
});
try {
mapper.map(null);
fail("Expected error");
} catch (Exception e) {
assertTrue(e instanceof IOException);
}
}
use of org.simpleflatmapper.map.mapper.MapperImpl in project SimpleFlatMapper by arnaudroger.
the class JdbcMapperBuilderTest method getSubMapper.
private Mapper<ResultSet, DbObject> getSubMapper(JdbcMapper<DbObject> mapper) throws Exception {
Field field;
try {
field = mapper.getClass().getDeclaredField("mapper");
} catch (NoSuchFieldException e) {
field = mapper.getClass().getSuperclass().getDeclaredField("mapper");
}
field.setAccessible(true);
return new FieldGetter<JdbcMapper<?>, MapperImpl<ResultSet, DbObject>>(field).get(mapper);
}
Aggregations