private void setupCursor() throws Exception { Statement statement = connection.createStatement(DatabaseConfig.getResultSetType(), ResultSet.CONCUR_READ_ONLY); String sql = "SELECT * FROM table_name;"; resultSet = statement.executeQuery("SELECT * FROM table_name;"); cursor = new SQLiteCursor(null, null, null, null); Robolectric.shadowOf(cursor).setResultSet(resultSet, sql); }
@Before public void setUp() throws Exception { connection = DatabaseConfig.getMemoryConnection(); Statement statement = connection.createStatement(); statement.execute( "CREATE TABLE table_name(" + "id INTEGER PRIMARY KEY, name VARCHAR(255), long_value BIGINT," + "float_value REAL, double_value DOUBLE, blob_value BINARY );"); addPeople(); setupCursor(); }