Search in sources :

Example 1 with FloatDelayedCellSetter

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

the class PrimitivesDelayedCellSetterTest method testFloatGetSetValue.

@Test
public void testFloatGetSetValue() throws Exception {
    Setter<DbPrimitiveObjectWithSetter, Float> floatSetter = objectSetterFactory.getSetter(DbPrimitiveObjectWithSetter.class, "pFloat");
    FloatDelayedCellSetter<DbPrimitiveObjectWithSetter> setter = new FloatDelayedCellSetter<DbPrimitiveObjectWithSetter>(ObjectSetterFactory.toFloatSetter(floatSetter), new FloatCellValueReaderImpl());
    setter.set("13".toCharArray(), 0, 2, null);
    assertEquals(new Float(13), setter.consumeValue());
    setter.set("13".toCharArray(), 0, 2, null);
    DbPrimitiveObjectWithSetter o = new DbPrimitiveObjectWithSetter();
    setter.set(o);
    assertEquals(13, o.getpFloat(), 0);
    setter.set("".toCharArray(), 0, 0, null);
    assertNull(setter.consumeValue());
}
Also used : DbPrimitiveObjectWithSetter(org.simpleflatmapper.test.beans.DbPrimitiveObjectWithSetter) FloatDelayedCellSetter(org.simpleflatmapper.csv.impl.primitive.FloatDelayedCellSetter) Test(org.junit.Test)

Aggregations

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