Search in sources :

Example 1 with ByteDelayedCellSetter

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

the class PrimitivesDelayedCellSetterTest method testByteGetSetValue.

@Test
public void testByteGetSetValue() throws Exception {
    Setter<DbPrimitiveObjectWithSetter, Byte> byteSetter = objectSetterFactory.getSetter(DbPrimitiveObjectWithSetter.class, "pByte");
    ByteDelayedCellSetter<DbPrimitiveObjectWithSetter> setter = new ByteDelayedCellSetter<DbPrimitiveObjectWithSetter>(ObjectSetterFactory.toByteSetter(byteSetter), new ByteCellValueReaderImpl());
    setter.set("13".toCharArray(), 0, 2, null);
    assertEquals(new Byte((byte) 13), setter.consumeValue());
    setter.set("13".toCharArray(), 0, 2, null);
    DbPrimitiveObjectWithSetter o = new DbPrimitiveObjectWithSetter();
    setter.set(o);
    assertEquals((byte) 13, o.getpByte());
    setter.set("".toCharArray(), 0, 0, null);
    assertNull(setter.consumeValue());
}
Also used : DbPrimitiveObjectWithSetter(org.simpleflatmapper.test.beans.DbPrimitiveObjectWithSetter) ByteDelayedCellSetter(org.simpleflatmapper.csv.impl.primitive.ByteDelayedCellSetter) Test(org.junit.Test)

Aggregations

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