use of org.simpleflatmapper.map.MapperBuildingException in project SimpleFlatMapper by arnaudroger.
the class ConstantTargetFieldMapperFactoryImplTest method testGetterNotFound.
@Test
public void testGetterNotFound() {
ConstantTargetFieldMapperFactory<Appendable, SampleFieldKey> factory = ConstantTargetFieldMapperFactoryImpl.<Appendable, SampleFieldKey>newInstance(setterFactory, Appendable.class);
try {
PropertyMeta<Object, Object> pm = mock(PropertyMeta.class);
PropertyMapping<Object, Object, SampleFieldKey, FieldMapperColumnDefinition<SampleFieldKey>> propertyMapping = new PropertyMapping<Object, Object, SampleFieldKey, FieldMapperColumnDefinition<SampleFieldKey>>(pm, new SampleFieldKey("hh", 0), FieldMapperColumnDefinition.<SampleFieldKey>identity());
factory.newFieldMapper(propertyMapping, null, RethrowMapperBuilderErrorHandler.INSTANCE);
fail();
} catch (MapperBuildingException e) {
}
}
use of org.simpleflatmapper.map.MapperBuildingException in project SimpleFlatMapper by arnaudroger.
the class RethrowMapperBuilderErrorHandlerTest method testSetterNotFound.
@Test
public void testSetterNotFound() {
RethrowMapperBuilderErrorHandler handler = RethrowMapperBuilderErrorHandler.INSTANCE;
try {
handler.propertyNotFound(this.getClass(), "prop");
fail("Expected exception");
} catch (MapperBuildingException e) {
}
}
use of org.simpleflatmapper.map.MapperBuildingException in project SimpleFlatMapper by arnaudroger.
the class RethrowMapperBuilderErrorHandlerTest method testGetterNotFound.
@Test
public void testGetterNotFound() {
RethrowMapperBuilderErrorHandler handler = RethrowMapperBuilderErrorHandler.INSTANCE;
try {
handler.accessorNotFound("prop");
fail("Expected exception");
} catch (MapperBuildingException e) {
}
}
use of org.simpleflatmapper.map.MapperBuildingException in project SimpleFlatMapper by arnaudroger.
the class ConstantSourceMapperBuilder method getConstructorFieldMappersAndInstantiator.
@SuppressWarnings("unchecked")
private InstantiatorAndFieldMappers getConstructorFieldMappersAndInstantiator() throws MapperBuildingException {
InstantiatorFactory instantiatorFactory = reflectionService.getInstantiatorFactory();
try {
ConstructorInjections constructorInjections = constructorInjections();
Map<Parameter, BiFunction<? super S, ? super MappingContext<? super S>, ?>> injections = constructorInjections.parameterGetterMap;
MapperBiInstantiatorFactory mapperBiInstantiatorFactory = new MapperBiInstantiatorFactory(instantiatorFactory);
GetterFactory<? super S, K> getterFactory = fieldMapperAsGetterFactory();
BiInstantiator<S, MappingContext<? super S>, T> instantiator = mapperBiInstantiatorFactory.<S, T, K, FieldMapperColumnDefinition<K>>getBiInstantiator(mapperSource.source(), target, propertyMappingsBuilder, injections, getterFactory, reflectionService.builderIgnoresNullValues());
return new InstantiatorAndFieldMappers(constructorInjections.fieldMappers, instantiator);
} catch (Exception e) {
return ErrorHelper.rethrow(e);
}
}
Aggregations