Search in sources :

Example 1 with BooleanDelayedCellSetter

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

the class PrimitivesDelayedCellSetterTest method testBooleanGetSetValue.

@Test
public void testBooleanGetSetValue() throws Exception {
    Setter<DbPrimitiveObjectWithSetter, Boolean> setter = objectSetterFactory.getSetter(DbPrimitiveObjectWithSetter.class, "pBoolean");
    BooleanDelayedCellSetter<DbPrimitiveObjectWithSetter> bSetter = new BooleanDelayedCellSetter<DbPrimitiveObjectWithSetter>(ObjectSetterFactory.toBooleanSetter(setter), new BooleanCellValueReaderImpl());
    bSetter.set("true".toCharArray(), 0, 4, null);
    assertTrue(bSetter.consumeValue());
    bSetter.set("true".toCharArray(), 0, 4, null);
    DbPrimitiveObjectWithSetter o = new DbPrimitiveObjectWithSetter();
    bSetter.set(o);
    assertTrue(o.ispBoolean());
    bSetter.set("".toCharArray(), 0, 0, null);
    assertNull(bSetter.consumeValue());
}
Also used : DbPrimitiveObjectWithSetter(org.simpleflatmapper.test.beans.DbPrimitiveObjectWithSetter) BooleanDelayedCellSetter(org.simpleflatmapper.csv.impl.primitive.BooleanDelayedCellSetter) Test(org.junit.Test)

Aggregations

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