DbAdapter implements StorageService { public static DbAdapter getInstance(Context context) { synchronized (sInstanceLock) { if (null == sInstance) { sInstance = new DbAdapter(context); } } return sInstance; } DbAdapter(Context context); static DbAdapter getInstance(Context context); int addEvent(Table table, String data); int count(Table table); Batch getEvents(Table table, int limit); List<Table> getTables(); int deleteEvents(Table table, String lastId); void deleteTable(Table table); void vacuum(); static final String KEY_DATA; static final String KEY_TOKEN; static final String KEY_TABLE; static final String KEY_CREATED_AT; static final String TABLES_TABLE; static final String REPORTS_TABLE; }
@Test public void getInstanceTest() { DbAdapter adapter1 = DbAdapter.getInstance(context); DbAdapter adapter2 = DbAdapter.getInstance(context); assertTrue(adapter1 == adapter2); }