Search in sources :

Example 1 with LongDelayedCellSetter

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

the class PrimitivesDelayedCellSetterTest method testLongGetSetValue.

@Test
public void testLongGetSetValue() throws Exception {
    Setter<DbPrimitiveObjectWithSetter, Long> longSetter = objectSetterFactory.getSetter(DbPrimitiveObjectWithSetter.class, "pLong");
    LongDelayedCellSetter<DbPrimitiveObjectWithSetter> setter = new LongDelayedCellSetter<DbPrimitiveObjectWithSetter>(ObjectSetterFactory.toLongSetter(longSetter), new LongCellValueReaderImpl());
    setter.set("13".toCharArray(), 0, 2, null);
    assertEquals(new Long(13), setter.consumeValue());
    setter.set("13".toCharArray(), 0, 2, null);
    DbPrimitiveObjectWithSetter o = new DbPrimitiveObjectWithSetter();
    setter.set(o);
    assertEquals(13, o.getpLong());
    setter.set("".toCharArray(), 0, 0, null);
    assertNull(setter.consumeValue());
}
Also used : DbPrimitiveObjectWithSetter(org.simpleflatmapper.test.beans.DbPrimitiveObjectWithSetter) LongDelayedCellSetter(org.simpleflatmapper.csv.impl.primitive.LongDelayedCellSetter) Test(org.junit.Test)

Aggregations

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