use of org.simpleflatmapper.csv.impl.cellreader.DelayedCellSetterImpl in project SimpleFlatMapper by arnaudroger.
the class CsvMapperCellHandlerImpAsmInstantiatorTest method testInstantiateStringWithCharArray.
@SuppressWarnings("unchecked")
@Test
public void testInstantiateStringWithCharArray() throws Exception {
HashMap<Parameter, Getter<? super CsvMapperCellHandlerImpl<String>, ?>> injections = new HashMap<Parameter, Getter<? super CsvMapperCellHandlerImpl<String>, ?>>();
Parameter parameter = new Parameter(0, "arg0", char[].class);
DelayedGetter delayedGetter = new DelayedGetter(0);
injections.put(parameter, delayedGetter);
Class<CsvMapperCellHandlerImpl<String>> source = (Class) CsvMapperCellHandlerImpl.class;
Instantiator<CsvMapperCellHandlerImpl<String>, String> instantiator = factory.createInstantiator(source, new ExecutableInstantiatorDefinition(String.class.getConstructor(char[].class), parameter), injections, true);
DelayedCellSetterImpl delayedCellSetter = new DelayedCellSetterImpl(null, new CellValueReader() {
@Override
public char[] read(char[] chars, int offset, int length, ParsingContext parsingContext) {
return new char[] { 'h' };
}
});
delayedCellSetter.set(null, 0, 0, null);
CsvMapperCellHandlerImpl targetSettersImpl = new CsvMapperCellHandlerImpl(instantiator, new DelayedCellSetter[] { delayedCellSetter }, new CellSetter[] {}, null, null, null);
Assert.assertNotNull(instantiator.newInstance(targetSettersImpl));
}
Aggregations