Search in sources :

Example 1 with DoubleDelayedCellSetter

use of org.simpleflatmapper.csv.impl.primitive.DoubleDelayedCellSetter in project SimpleFlatMapper by arnaudroger.

the class PrimitivesDelayedCellSetterTest method testDoubleGetSetValue.

@Test
public void testDoubleGetSetValue() throws Exception {
    Setter<DbPrimitiveObjectWithSetter, Double> doubleSetter = objectSetterFactory.getSetter(DbPrimitiveObjectWithSetter.class, "pDouble");
    DoubleDelayedCellSetter<DbPrimitiveObjectWithSetter> setter = new DoubleDelayedCellSetter<DbPrimitiveObjectWithSetter>(ObjectSetterFactory.toDoubleSetter(doubleSetter), new DoubleCellValueReaderImpl());
    setter.set("13".toCharArray(), 0, 2, null);
    assertEquals(new Double(13), setter.consumeValue());
    setter.set("13".toCharArray(), 0, 2, null);
    DbPrimitiveObjectWithSetter o = new DbPrimitiveObjectWithSetter();
    setter.set(o);
    assertEquals(13, o.getpDouble(), 0);
    setter.set("".toCharArray(), 0, 0, null);
    assertNull(setter.consumeValue());
}
Also used : DbPrimitiveObjectWithSetter(org.simpleflatmapper.test.beans.DbPrimitiveObjectWithSetter) DoubleDelayedCellSetter(org.simpleflatmapper.csv.impl.primitive.DoubleDelayedCellSetter) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 DoubleDelayedCellSetter (org.simpleflatmapper.csv.impl.primitive.DoubleDelayedCellSetter)1 DbPrimitiveObjectWithSetter (org.simpleflatmapper.test.beans.DbPrimitiveObjectWithSetter)1