use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class QueryMapperUnitTests method shouldMapSomeNestedCriteria.
// DATAJDBC-318
@Test
public void shouldMapSomeNestedCriteria() {
Criteria criteria = Criteria.empty().and(Collections.emptyList()).and(Criteria.empty().and(Criteria.where("name").is("Hank")));
assertThat(criteria.isEmpty()).isFalse();
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 shouldMapNeq.
// DATAJDBC-318
@Test
public void shouldMapNeq() {
Criteria criteria = Criteria.where("name").not("foo");
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 shouldMapFrom.
// DATAJDBC-318
@Test
public void shouldMapFrom() {
Criteria criteria = //
Criteria.from(Criteria.where("name").is("Foo")).and(//
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 shouldNotMapEmptyNestedCriteria.
// DATAJDBC-318
@Test
public void shouldNotMapEmptyNestedCriteria() {
Criteria criteria = Criteria.empty().and(Collections.emptyList()).and(Criteria.empty().and(Criteria.empty()));
assertThat(criteria.isEmpty()).isTrue();
assertThatIllegalArgumentException().isThrownBy(() -> map(criteria));
}
use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class QueryMapperUnitTests method shouldNotMapEmptyAndCriteria.
// DATAJDBC-318
@Test
public void shouldNotMapEmptyAndCriteria() {
Criteria criteria = Criteria.empty().and(Collections.emptyList());
assertThatIllegalArgumentException().isThrownBy(() -> map(criteria));
}
Aggregations