use of com.orm.androrm.impl.BlankModel in project androrm by androrm.
the class DateFieldTest method testStorage.
public void testStorage() {
Date date = Calendar.getInstance().getTime();
BlankModel model = new BlankModel();
model.setDate(date);
model.save(getContext());
assertEquals(date, model.getDate());
model = Model.objects(getContext(), BlankModel.class).get(model.getId());
Date newDate = model.getDate();
assertNotNull(newDate);
assertEquals(date.getYear(), newDate.getYear());
assertEquals(date.getMonth(), newDate.getMonth());
assertEquals(date.getDay(), newDate.getDay());
assertEquals(date.getHours(), newDate.getHours());
assertEquals(date.getMinutes(), newDate.getMinutes());
assertEquals(date.getSeconds(), newDate.getSeconds());
}
use of com.orm.androrm.impl.BlankModel in project androrm by androrm.
the class ModelTest method testEquals.
public void testEquals() {
BlankModel m = new BlankModel();
m.setName("test");
m.save(getContext());
BlankModel m2 = Model.objects(getContext(), BlankModel.class).get(m.getId());
assertEquals(m, m2);
BlankModelNoAutoincrement m3 = new BlankModelNoAutoincrement();
m3.save(getContext(), 1);
assertFalse(m.equals(m3));
}
use of com.orm.androrm.impl.BlankModel in project androrm by androrm.
the class ModelTest method testDelete.
public void testDelete() {
BlankModel m = new BlankModel();
assertFalse(m.delete(getContext()));
m.save(getContext());
int id = m.getId();
assertTrue(m.delete(getContext()));
assertNull(m.getName());
assertNull(m.getLocation());
assertNull(m.getDate());
assertNull(Model.objects(getContext(), BlankModel.class).get(id));
assertEquals(0, m.getId());
}
Aggregations