use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class CriteriaUnitTests method shouldBuildIsFalseCriteria.
// DATAJDBC-513
@Test
void shouldBuildIsFalseCriteria() {
Criteria criteria = where("foo").isFalse();
assertThat(criteria.getColumn()).isEqualTo(SqlIdentifier.unquoted("foo"));
assertThat(criteria.getComparator()).isEqualTo(CriteriaDefinition.Comparator.IS_FALSE);
assertThat(criteria.getValue()).isEqualTo(false);
}
use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class CriteriaUnitTests method andChainedCriteria.
// DATAJDBC-513
@Test
void andChainedCriteria() {
Criteria criteria = where("foo").is("bar").and("baz").isNotNull();
assertThat(criteria.getColumn()).isEqualTo(SqlIdentifier.unquoted("baz"));
assertThat(criteria.getComparator()).isEqualTo(CriteriaDefinition.Comparator.IS_NOT_NULL);
assertThat(criteria.getValue()).isNull();
assertThat(criteria.getPrevious()).isNotNull();
assertThat(criteria.getCombinator()).isEqualTo(Criteria.Combinator.AND);
criteria = criteria.getPrevious();
assertThat(criteria.getColumn()).isEqualTo(SqlIdentifier.unquoted("foo"));
assertThat(criteria.getComparator()).isEqualTo(CriteriaDefinition.Comparator.EQ);
assertThat(criteria.getValue()).isEqualTo("bar");
}
use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class CriteriaUnitTests method shouldBuildEqualsCriteria.
// DATAJDBC-513
@Test
void shouldBuildEqualsCriteria() {
Criteria criteria = where("foo").is("bar");
assertThat(criteria.getColumn()).isEqualTo(SqlIdentifier.unquoted("foo"));
assertThat(criteria.getComparator()).isEqualTo(CriteriaDefinition.Comparator.EQ);
assertThat(criteria.getValue()).isEqualTo("bar");
}
use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class CriteriaUnitTests method orChainedCriteria.
// DATAJDBC-513
@Test
void orChainedCriteria() {
Criteria criteria = where("foo").is("bar").or("baz").isNotNull();
assertThat(criteria.getColumn()).isEqualTo(SqlIdentifier.unquoted("baz"));
assertThat(criteria.getCombinator()).isEqualTo(Criteria.Combinator.OR);
criteria = criteria.getPrevious();
assertThat(criteria).isNotNull();
assertThat(criteria.getPrevious()).isNull();
assertThat(criteria.getValue()).isEqualTo("bar");
}
use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class CriteriaUnitTests method shouldBuildLikeCriteria.
// DATAJDBC-513
@Test
void shouldBuildLikeCriteria() {
Criteria criteria = where("foo").like("hello%");
assertThat(criteria.getColumn()).isEqualTo(SqlIdentifier.unquoted("foo"));
assertThat(criteria.getComparator()).isEqualTo(CriteriaDefinition.Comparator.LIKE);
assertThat(criteria.getValue()).isEqualTo("hello%");
}
Aggregations