Package ma.glasnost.orika.converter.builtin.NumericConverters

Examples of ma.glasnost.orika.converter.builtin.NumericConverters.DoubleToIntegerConverter


    }
   
    @Test
    public void testDoubleToIntegerConverter() {
        MapperFactory factory = MappingUtil.getMapperFactory();
        factory.getConverterFactory().registerConverter(new DoubleToIntegerConverter(false));
        MapperFacade mapper = factory.getMapperFacade();
       
        Double value = (double) Integer.MAX_VALUE;
        Integer result = mapper.map(value, Integer.class);
        Assert.assertEquals(value.doubleValue(), result.doubleValue());
View Full Code Here


    }
   
    @Test(expected = MappingException.class)
    public void testDoubleToIntegerConverter_overflow() {
        MapperFactory factory = MappingUtil.getMapperFactory();
        factory.getConverterFactory().registerConverter(new DoubleToIntegerConverter(false));
        MapperFacade mapper = factory.getMapperFacade();
       
        Double value = (double) Integer.MAX_VALUE + 1;
        Integer result = mapper.map(value, Integer.class);
        Assert.assertEquals(value.doubleValue(), result.doubleValue());
View Full Code Here

TOP

Related Classes of ma.glasnost.orika.converter.builtin.NumericConverters.DoubleToIntegerConverter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.