use of com.cadenzauk.siesta.model.WidgetRow in project siesta by cadenzauk.
the class FromTest method validateInvalidThrows.
@Test
void validateInvalidThrows() {
Database database = testDatabase(new AnsiDialect());
calling(() -> database.from(WidgetRow.class).join(ManufacturerRow.class, "m").on(WidgetRow::name).isEqualTo("Fred").sql()).shouldThrow(InvalidJoinException.class).withMessage(is("Joined table 'SIESTA.MANUFACTURER m' is not referenced in the ON clause."));
}
use of com.cadenzauk.siesta.model.WidgetRow in project siesta by cadenzauk.
the class SelectExpressionTest method isNotLike.
@Test
void isNotLike() {
Database database = testDatabase(new AnsiDialect());
String sql = database.from(WidgetRow.class).where(WidgetRow::name).isNotLike("abc%").sql();
assertThat(sql, is("select WIDGET.WIDGET_ID as WIDGET_WIDGET_ID, " + "WIDGET.NAME as WIDGET_NAME, " + "WIDGET.MANUFACTURER_ID as WIDGET_MANUFACTURER_ID, " + "WIDGET.DESCRIPTION as WIDGET_DESCRIPTION " + "from SIESTA.WIDGET WIDGET " + "where WIDGET.NAME not like ?"));
}
use of com.cadenzauk.siesta.model.WidgetRow in project siesta by cadenzauk.
the class SelectExpressionTest method isNotNull.
@Test
void isNotNull() {
Database database = testDatabase(new AnsiDialect());
String sql = database.from(WidgetRow.class).where(WidgetRow::manufacturerId).isNotNull().sql();
assertThat(sql, is("select WIDGET.WIDGET_ID as WIDGET_WIDGET_ID, " + "WIDGET.NAME as WIDGET_NAME, " + "WIDGET.MANUFACTURER_ID as WIDGET_MANUFACTURER_ID, " + "WIDGET.DESCRIPTION as WIDGET_DESCRIPTION " + "from SIESTA.WIDGET WIDGET " + "where WIDGET.MANUFACTURER_ID is not null"));
}
use of com.cadenzauk.siesta.model.WidgetRow in project siesta by cadenzauk.
the class SelectExpressionTest method isNull.
@Test
void isNull() {
Database database = testDatabase(new AnsiDialect());
String sql = database.from(WidgetRow.class).where(WidgetRow::description).isNull().sql();
assertThat(sql, is("select WIDGET.WIDGET_ID as WIDGET_WIDGET_ID, " + "WIDGET.NAME as WIDGET_NAME, " + "WIDGET.MANUFACTURER_ID as WIDGET_MANUFACTURER_ID, " + "WIDGET.DESCRIPTION as WIDGET_DESCRIPTION " + "from SIESTA.WIDGET WIDGET " + "where WIDGET.DESCRIPTION is null"));
}
use of com.cadenzauk.siesta.model.WidgetRow in project siesta by cadenzauk.
the class SelectExpressionTest method isNotIn.
@Test
void isNotIn() {
Database database = testDatabase(new AnsiDialect());
String sql = database.from(WidgetRow.class).where(WidgetRow::widgetId).isNotIn(123L, 456L, 789L).sql();
assertThat(sql, is("select WIDGET.WIDGET_ID as WIDGET_WIDGET_ID, " + "WIDGET.NAME as WIDGET_NAME, " + "WIDGET.MANUFACTURER_ID as WIDGET_MANUFACTURER_ID, " + "WIDGET.DESCRIPTION as WIDGET_DESCRIPTION " + "from SIESTA.WIDGET WIDGET " + "where WIDGET.WIDGET_ID not in (?, ?, ?)"));
}
Aggregations