Search in sources :

Example 1 with RethrowMapperBuilderErrorHandler

use of org.simpleflatmapper.map.error.RethrowMapperBuilderErrorHandler 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) {
    }
}
Also used : RethrowMapperBuilderErrorHandler(org.simpleflatmapper.map.error.RethrowMapperBuilderErrorHandler) MapperBuildingException(org.simpleflatmapper.map.MapperBuildingException) Test(org.junit.Test)

Example 2 with RethrowMapperBuilderErrorHandler

use of org.simpleflatmapper.map.error.RethrowMapperBuilderErrorHandler 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) {
    }
}
Also used : RethrowMapperBuilderErrorHandler(org.simpleflatmapper.map.error.RethrowMapperBuilderErrorHandler) MapperBuildingException(org.simpleflatmapper.map.MapperBuildingException) Test(org.junit.Test)

Example 3 with RethrowMapperBuilderErrorHandler

use of org.simpleflatmapper.map.error.RethrowMapperBuilderErrorHandler in project SimpleFlatMapper by arnaudroger.

the class AbstractMapperFactoryTest method testDefaultMapperConfig.

@Test
public void testDefaultMapperConfig() {
    MapperFactory mapperFactory = new MapperFactory();
    MapperConfig<SampleFieldKey, FieldMapperColumnDefinition<SampleFieldKey>> mapperConfig = mapperFactory.mapperConfig();
    final ArrayList<Object> properties = new ArrayList<Object>();
    mapperConfig.columnDefinitions().forEach(Object.class, new BiConsumer<Predicate<? super SampleFieldKey>, Object>() {

        @Override
        public void accept(Predicate<? super SampleFieldKey> predicate, Object o) {
            properties.add(o);
        }
    });
    assertTrue(properties.isEmpty());
    assertFalse(mapperConfig.failOnAsm());
    assertEquals(NO_ASM_MAPPER_THRESHOLD, mapperConfig.asmMapperNbFieldsLimit());
    assertNull(mapperConfig.fieldMapperErrorHandler());
    assertFalse(mapperConfig.hasFieldMapperErrorHandler());
    assertTrue(mapperConfig.mapperBuilderErrorHandler() instanceof RethrowMapperBuilderErrorHandler);
    assertTrue(mapperConfig.consumerErrorHandler() instanceof RethrowConsumerErrorHandler);
    assertEquals(MapperConfig.MAX_METHOD_SIZE, mapperConfig.maxMethodSize());
    assertTrue(mapperConfig.propertyNameMatcherFactory() instanceof DefaultPropertyNameMatcherFactory);
    assertTrue(mapperFactory.getReflectionService().isAsmActivated());
}
Also used : FieldMapperColumnDefinition(org.simpleflatmapper.map.property.FieldMapperColumnDefinition) ArrayList(java.util.ArrayList) Predicate(org.simpleflatmapper.util.Predicate) RethrowMapperBuilderErrorHandler(org.simpleflatmapper.map.error.RethrowMapperBuilderErrorHandler) AbstractMapperFactory(org.simpleflatmapper.map.mapper.AbstractMapperFactory) RethrowConsumerErrorHandler(org.simpleflatmapper.map.error.RethrowConsumerErrorHandler) SampleFieldKey(org.simpleflatmapper.test.map.SampleFieldKey) DefaultPropertyNameMatcherFactory(org.simpleflatmapper.map.mapper.DefaultPropertyNameMatcherFactory) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 RethrowMapperBuilderErrorHandler (org.simpleflatmapper.map.error.RethrowMapperBuilderErrorHandler)3 MapperBuildingException (org.simpleflatmapper.map.MapperBuildingException)2 ArrayList (java.util.ArrayList)1 RethrowConsumerErrorHandler (org.simpleflatmapper.map.error.RethrowConsumerErrorHandler)1 AbstractMapperFactory (org.simpleflatmapper.map.mapper.AbstractMapperFactory)1 DefaultPropertyNameMatcherFactory (org.simpleflatmapper.map.mapper.DefaultPropertyNameMatcherFactory)1 FieldMapperColumnDefinition (org.simpleflatmapper.map.property.FieldMapperColumnDefinition)1 SampleFieldKey (org.simpleflatmapper.test.map.SampleFieldKey)1 Predicate (org.simpleflatmapper.util.Predicate)1