EventResolver extends UrbanAirshipResolver { int getDatabaseSize() { Integer result = null; String[] columns = new String[] { "SUM(" + EventsStorage.Events.COLUMN_NAME_EVENT_SIZE + ") as _size" }; Cursor cursor = query(uri, columns, null, null, null); if (cursor == null) { Logger.error("EventsStorage - Unable to query events database."); return -1; } if (cursor.moveToFirst()) { result = cursor.getInt(0); } cursor.close(); return result == null ? -1 : result; } EventResolver(@NonNull Context context);  @NonNull
    static final String ASCENDING_SORT_ORDER; }
@Test public void testGetDatabaseSize() { assertEquals(0, eventResolver.getDatabaseSize()); TestEvent event = new TestEvent(); int eventSize = event.createEventPayload("session id").length(); eventResolver.insertEvent(event, "session id"); assertEquals(eventSize, eventResolver.getDatabaseSize()); eventResolver.insertEvent(new TestEvent(), "session id"); eventResolver.insertEvent(new TestEvent(), "session id"); assertEquals(eventSize * 3, eventResolver.getDatabaseSize()); }