AndroidStatementExecutor implements StatementExecutor<Cursor> { @Override public void execute(@NotNull final FinishedStatement finishedStatement) { String sql = mStatementConverter.toSql(finishedStatement); Object[] arguments = mStatementConverter.retrieveArguments(finishedStatement); mDatabase.execSQL(sql, arguments); } AndroidStatementExecutor(@NotNull final SQLiteDatabase database); @Override void execute(@NotNull final FinishedStatement finishedStatement); @Override Cursor execute(@NotNull final FinishedSelectStatement finishedSelectStatement); @Override long execute(@NotNull final FinishedInsertStatement finishedInsertStatement); @Override long execute(@NotNull final FinishedUpdateStatement finishedUpdateStatement); @Override long execute(@NotNull final FinishedDeleteStatement finishedDeleteStatement);  }
@Test public void executeStatement_delegatesToDatabase() { FinishedStatement statement = mock(FinishedStatement.class); when(statement.iterator()).thenReturn(new SqlPartIterator()); mStatementExecutor.execute(statement); verify(mDatabaseMock).execSQL(anyString(), any(Object[].class)); }
@Test public void executeQuery_delegatesToDatabase() { FinishedSelectStatement query = mock(FinishedSelectStatement.class); when(query.iterator()).thenReturn(new SqlPartIterator()); mStatementExecutor.execute(query); verify(mDatabaseMock).rawQuery(anyString(), any(String[].class)); }