use of com.dailystudio.dataobject.Column in project devbricks by dailystudio.
the class LongColumnTest method testParseValueFrom.
public void testParseValueFrom() {
Column columnA = new LongColumn("columnA");
assertNotNull(columnA);
Column columnB = new LongColumn("columnB");
assertNotNull(columnB);
SimpleLongCursor c = new SimpleLongCursor();
c.putColumnValue(columnA.getName(), 987654321012345678l);
c.putColumnValue(columnB.getName(), -1234567654321l);
ContentValues values = new ContentValues();
assertNotNull(values);
columnA.parseValueFrom(c, values);
columnB.parseValueFrom(c, values);
long actual = 0;
actual = values.getAsLong(columnA.getName());
assertEquals(987654321012345678l, actual);
actual = values.getAsLong(columnB.getName());
assertEquals(-1234567654321l, actual);
}
use of com.dailystudio.dataobject.Column in project devbricks by dailystudio.
the class LongColumnTest method testGetValue.
public void testGetValue() {
Column columnA = new LongColumn("columnA");
assertNotNull(columnA);
Column columnB = new LongColumn("columnB");
assertNotNull(columnB);
ContentValues values = new ContentValues();
columnA.setValue(values, 987654321012345678l);
assertEquals(new Long(987654321012345678l), columnA.getValue(values));
columnB.setValue(values, -12345678l);
assertEquals(new Long(-12345678l), columnB.getValue(values));
}
use of com.dailystudio.dataobject.Column in project devbricks by dailystudio.
the class LongColumnTest method testSetValue.
public void testSetValue() {
Column column = null;
column = new LongColumn("columnA");
assertNotNull(column);
ContentValues values = new ContentValues();
column.setValue(values, 987654321012345678l);
assertEquals(new Long(987654321012345678l), values.getAsLong("columnA"));
column.setValue(values, -12345678l);
assertEquals(new Long(-12345678l), values.getAsLong("columnA"));
boolean exceptionCacthed = false;
try {
column.setValue(values, 123);
exceptionCacthed = false;
} catch (ClassCastException e) {
exceptionCacthed = true;
}
assertEquals(true, exceptionCacthed);
try {
column.setValue(values, 3.1415);
exceptionCacthed = false;
} catch (ClassCastException e) {
exceptionCacthed = true;
}
assertEquals(true, exceptionCacthed);
}
use of com.dailystudio.dataobject.Column in project devbricks by dailystudio.
the class LongColumnTest method testColumnToString.
public void testColumnToString() {
Column column = null;
column = new LongColumn("time");
assertNotNull(column);
assertEquals("time LONG", column.toString());
column = new LongColumn("time", false);
assertNotNull(column);
assertEquals("time LONG NOT NULL", column.toString());
column = new LongColumn("time", false, true);
assertNotNull(column);
assertEquals("time LONG NOT NULL PRIMARY KEY", column.toString());
}
use of com.dailystudio.dataobject.Column in project devbricks by dailystudio.
the class LongColumnTest method testAttachValueTo.
public void testAttachValueTo() {
Column columnA = new LongColumn("columnA");
assertNotNull(columnA);
Column columnB = new LongColumn("columnB");
assertNotNull(columnB);
ContentValues values = new ContentValues();
assertNotNull(values);
columnA.setValue(values, 987654321012345678l);
columnB.setValue(values, -1234567654321l);
Intent i = new Intent();
assertNotNull(i);
columnA.attachValueTo(i, values);
columnB.attachValueTo(i, values);
long actual = 0;
actual = i.getLongExtra(columnA.getName(), -1l);
assertEquals(987654321012345678l, actual);
actual = i.getLongExtra(columnB.getName(), -1l);
assertEquals(-1234567654321l, actual);
}
Aggregations