DeleteFromImpl extends BaseFinishedDeleteStatement implements DeleteFrom { @Override public void prependTo(@NotNull final RawSqlBuilder builder) { builder.prepend(mTableName); if (mDatabaseName != null) { builder.prepend('.').prepend(mDatabaseName); } builder.prepend("FROM "); } DeleteFromImpl(@Nullable final String databaseName, @NotNull final String tableName, @NotNull final SqlPart previous); @NotNull @Override DeleteWhere where(@NotNull final String expression, @NotNull final Object... arguments); @Override void prependTo(@NotNull final RawSqlBuilder builder); @Nullable @Override SqlPart previous();  }
@Test public void prependTo_forTable_prependsProperSql() { DeleteFromImpl deleteFrom = new DeleteFromImpl(null, "table", mock(SqlPart.class)); RawSqlBuilder builder = new RawSqlBuilderImpl(); deleteFrom.prependTo(builder); assertThat(builder.toString(), is("FROM table")); }
@Test public void prependTo_forDatabaseAndTable_prependsProperSql() { DeleteFromImpl deleteFrom = new DeleteFromImpl("database", "table", mock(SqlPart.class)); RawSqlBuilder builder = new RawSqlBuilderImpl(); deleteFrom.prependTo(builder); assertThat(builder.toString(), is("FROM database.table")); }