### Question:
Model implements QueryResult { final public boolean save() { Transaction t = new Transaction(); try { t.setSuccessful(save(t)); } finally { t.finish(); } return t.isSuccessful(); }  boolean isValid(); final boolean exists(); final boolean save(); final boolean save(Transaction t); final void saveAsync(); final void saveAsync(final OnSavedCallback callback); final void delete(); final void delete(Transaction t); final void deleteAsync(); final void deleteAsync(final OnDeletedCallback callback);  }### Answer:
@Test public void notifyContentChangeOnSave() { TestModel m = new TestModel(); m.title = "hej"; final boolean[] notified = new boolean[1]; Sprinkles.sInstance.mContext.getContentResolver(). registerContentObserver(Utils.getNotificationUri(TestModel.class), false, new ContentObserver(new Handler()) { @Override public void onChange(boolean selfChange) { notified[0] = true; } }); m.save(); assertTrue(notified[0]); }
@Test public void save() { TestModel m = new TestModel(); m.title = "hej"; m.save(); assertTrue(m.exists()); }
@Test public void setAutoIncrementKeyOnCreate() { TestModel m = new TestModel(); m.title = "hej"; m.save(); assertFalse(m.id == 0); }
@Test public void saveWithNullField() { TestModel m = new TestModel(); m.title = "hej"; assertTrue(m.save()); assertEquals(Query.one(TestModel.class, "select * from Tests").get().title, "hej"); m.title = null; assertTrue(m.save()); assertEquals(Query.one(TestModel.class, "select * from Tests").get().title, null); }