use of com.orm.androrm.impl.BlankModelNoAutoincrement in project androrm by androrm.
the class ModelTest method testInitialId.
public void testInitialId() {
Model m = new BlankModel();
assertEquals(0, m.getId());
m = new BlankModelNoAutoincrement();
assertEquals(0, m.getId());
}
use of com.orm.androrm.impl.BlankModelNoAutoincrement 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.BlankModelNoAutoincrement in project androrm by androrm.
the class ModelTest method testSaveAutoincrementOverwrite.
public void testSaveAutoincrementOverwrite() {
Model m = new BlankModelNoAutoincrement();
// initial id has to be given
assertFalse(m.save(getContext()));
assertTrue(m.save(getContext(), 5));
assertEquals(5, m.getId());
// after id is set, regular save function works
assertTrue(m.save(getContext()));
}
Aggregations