use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class CriteriaUnitTests method shouldBuildIsTrueCriteria.
// DATAJDBC-513
@Test
void shouldBuildIsTrueCriteria() {
Criteria criteria = where("foo").isTrue();
assertThat(criteria.getColumn()).isEqualTo(SqlIdentifier.unquoted("foo"));
assertThat(criteria.getComparator()).isEqualTo(CriteriaDefinition.Comparator.IS_TRUE);
assertThat(criteria.getValue()).isEqualTo(true);
}
use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class QueryMapperUnitTests method shouldMapIsGte.
// DATAJDBC-318
@Test
public void shouldMapIsGte() {
Criteria criteria = Criteria.where("name").greaterThanOrEquals("a");
Condition condition = map(criteria);
assertThat(condition).hasToString("person.\"NAME\" >= ?[:name]");
}
use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class QueryMapperUnitTests method shouldMapIsGt.
// DATAJDBC-318
@Test
public void shouldMapIsGt() {
Criteria criteria = Criteria.where("name").greaterThan("a");
Condition condition = map(criteria);
assertThat(condition).hasToString("person.\"NAME\" > ?[:name]");
}
use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class QueryMapperUnitTests method shouldMapFromConcat.
// DATAJDBC-560
@Test
public void shouldMapFromConcat() {
Criteria criteria = Criteria.from(Criteria.where("name").is("Foo"), //
Criteria.where("name").is("Bar").or("age").lessThan(49));
assertThat(criteria.isEmpty()).isFalse();
Condition condition = map(criteria);
assertThat(condition).hasToString("(person.\"NAME\" = ?[:name] AND (person.\"NAME\" = ?[:name1] OR person.age < ?[:age]))");
}
use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class QueryMapperUnitTests method shouldConsiderColumnName.
// DATAJDBC-318
@Test
public void shouldConsiderColumnName() {
Criteria criteria = Criteria.where("alternative").is("foo");
Condition condition = map(criteria);
assertThat(condition).hasToString("person.\"another_name\" = ?[:another_name]");
}
Aggregations