Code example for Cursor

Methods: getCountisClosedmoveToFirst

0
        assertThat(stringValueFromDatabase).isEqualTo(name);
    } 
 
    protected void assertEmptyDatabase() { 
        Cursor cursor = database.query("table_name", new String[]{"id", "name"}, null, null, null, null, null);
        assertThat(cursor.moveToFirst()).isFalse();
        assertThat(cursor.isClosed()).isFalse();
        assertThat(cursor.getCount()).isEqualTo(0);
    } 
 
    protected void assertNonEmptyDatabase() { 
        Cursor cursor = database.query("table_name", new String[]{"id", "name"}, null, null, null, null, null);
        assertThat(cursor.moveToFirst()).isTrue();
        assertThat(cursor.getCount()).isNotEqualTo(0);
    } 
} 
Connect your IDE to all the code out there  Get Codota for Java