use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class CriteriaUnitTests method shouldBuildLtCriteria.
// DATAJDBC-513
@Test
void shouldBuildLtCriteria() {
Criteria criteria = where("foo").lessThan(1);
assertThat(criteria.getColumn()).isEqualTo(SqlIdentifier.unquoted("foo"));
assertThat(criteria.getComparator()).isEqualTo(CriteriaDefinition.Comparator.LT);
assertThat(criteria.getValue()).isEqualTo(1);
}
use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class CriteriaUnitTests method shouldBuildLteCriteria.
// DATAJDBC-513
@Test
void shouldBuildLteCriteria() {
Criteria criteria = where("foo").lessThanOrEquals(1);
assertThat(criteria.getColumn()).isEqualTo(SqlIdentifier.unquoted("foo"));
assertThat(criteria.getComparator()).isEqualTo(CriteriaDefinition.Comparator.LTE);
assertThat(criteria.getValue()).isEqualTo(1);
}
use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class CriteriaUnitTests method shouldBuildGteCriteria.
// DATAJDBC-513
@Test
void shouldBuildGteCriteria() {
Criteria criteria = where("foo").greaterThanOrEquals(1);
assertThat(criteria.getColumn()).isEqualTo(SqlIdentifier.unquoted("foo"));
assertThat(criteria.getComparator()).isEqualTo(CriteriaDefinition.Comparator.GTE);
assertThat(criteria.getValue()).isEqualTo(1);
}
use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class CriteriaUnitTests method shouldBuildInCriteria.
// DATAJDBC-513
@Test
void shouldBuildInCriteria() {
Criteria criteria = where("foo").in("bar", "baz");
assertThat(criteria.getColumn()).isEqualTo(SqlIdentifier.unquoted("foo"));
assertThat(criteria.getComparator()).isEqualTo(CriteriaDefinition.Comparator.IN);
assertThat(criteria.getValue()).isEqualTo(Arrays.asList("bar", "baz"));
assertThat(criteria).hasToString("foo IN ('bar', 'baz')");
}
use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class CriteriaUnitTests method fromCriteriaOptimized.
// DATAJDBC-513
@Test
void fromCriteriaOptimized() {
Criteria nested = where("foo").is("bar").and("baz").isNotNull();
CriteriaDefinition criteria = Criteria.from(nested);
assertThat(criteria).isSameAs(nested).hasToString("foo = 'bar' AND baz IS NOT NULL");
}
Aggregations