Search in sources :

Example 1 with CharDelayedCellSetter

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

the class PrimitivesDelayedCellSetterTest method testCharGetSetValue.

@Test
public void testCharGetSetValue() throws Exception {
    Setter<DbPrimitiveObjectWithSetter, Character> charSetter = objectSetterFactory.getSetter(DbPrimitiveObjectWithSetter.class, "pChar");
    CharDelayedCellSetter<DbPrimitiveObjectWithSetter> setter = new CharDelayedCellSetter<DbPrimitiveObjectWithSetter>(ObjectSetterFactory.toCharacterSetter(charSetter), new CharCellValueReaderImpl());
    setter.set("13".toCharArray(), 0, 2, null);
    assertEquals(new Character((char) 13), setter.consumeValue());
    setter.set("13".toCharArray(), 0, 2, null);
    DbPrimitiveObjectWithSetter o = new DbPrimitiveObjectWithSetter();
    setter.set(o);
    assertEquals((char) 13, o.getpCharacter());
    setter.set("".toCharArray(), 0, 0, null);
    assertNull(setter.consumeValue());
}
Also used : CharDelayedCellSetter(org.simpleflatmapper.csv.impl.primitive.CharDelayedCellSetter) DbPrimitiveObjectWithSetter(org.simpleflatmapper.test.beans.DbPrimitiveObjectWithSetter) Test(org.junit.Test)

Aggregations

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