### Question:
SugarTransactionHelper { public static void doInTransaction(Callback callback) { final SQLiteDatabase database = getSugarContext().getSugarDb().getDB(); database.beginTransaction(); try { if (ManifestHelper.isDebugEnabled()) { Log.d(LOG_TAG, "Callback executing within transaction"); } callback.manipulateInTransaction(); database.setTransactionSuccessful(); if (ManifestHelper.isDebugEnabled()) { Log.d(LOG_TAG, "Callback successfully executed within transaction"); } } catch (Throwable e) { if (ManifestHelper.isDebugEnabled()) { Log.d(LOG_TAG, "Could execute callback within transaction", e); } } finally { database.endTransaction(); } } private  SugarTransactionHelper(); static void doInTransaction(Callback callback);  }### Answer:
@Test public void testDoInTransaction() { SugarTransactionHelper.doInTransaction(new SugarTransactionHelper.Callback() { @Override public void manipulateInTransaction() { for (TestRecord record: recordList) { TestRecord.save(record); } } }); final List<TestRecord> results = TestRecord.listAll(TestRecord.class); assertEquals(true, inList(results, record1)); assertEquals(true, inList(results, record2)); assertEquals(true, inList(results, record3)); }