Search in sources :

Example 1 with ShortDelayedCellSetter

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

the class PrimitivesDelayedCellSetterTest method testShortGetSetValue.

@Test
public void testShortGetSetValue() throws Exception {
    Setter<DbPrimitiveObjectWithSetter, Short> shortSetter = objectSetterFactory.getSetter(DbPrimitiveObjectWithSetter.class, "pShort");
    ShortDelayedCellSetter<DbPrimitiveObjectWithSetter> setter = new ShortDelayedCellSetter<DbPrimitiveObjectWithSetter>(ObjectSetterFactory.toShortSetter(shortSetter), new ShortCellValueReaderImpl());
    setter.set("13".toCharArray(), 0, 2, null);
    assertEquals(new Short((short) 13), setter.consumeValue());
    setter.set("13".toCharArray(), 0, 2, null);
    DbPrimitiveObjectWithSetter o = new DbPrimitiveObjectWithSetter();
    setter.set(o);
    assertEquals((short) 13, o.getpShort());
    setter.set("".toCharArray(), 0, 0, null);
    assertNull(setter.consumeValue());
}
Also used : DbPrimitiveObjectWithSetter(org.simpleflatmapper.test.beans.DbPrimitiveObjectWithSetter) ShortDelayedCellSetter(org.simpleflatmapper.csv.impl.primitive.ShortDelayedCellSetter) Test(org.junit.Test)

Aggregations

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