use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class QueryMapperUnitTests method shouldMapIsLike.
// DATAJDBC-318
@Test
public void shouldMapIsLike() {
Criteria criteria = Criteria.where("name").like("a");
Condition condition = map(criteria);
assertThat(condition).hasToString("person.\"NAME\" LIKE ?[:name]");
}
use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class CriteriaFactoryUnitTests method shouldConsiderIterableValuesInInOperator.
// DATAJDBC-539
@Test
void shouldConsiderIterableValuesInInOperator() {
QueryMethod queryMethod = getQueryMethod("findAllByNameIn", List.class);
RelationalParametersParameterAccessor accessor = getAccessor(queryMethod, Arrays.asList("foo", "bar"));
ParameterMetadataProvider parameterMetadata = new ParameterMetadataProvider(accessor);
CriteriaFactory criteriaFactory = new CriteriaFactory(parameterMetadata);
Part part = new Part("NameIn", User.class);
Criteria criteria = criteriaFactory.createCriteria(part);
assertThat(criteria.getValue()).isEqualTo(Arrays.asList("foo", "bar"));
}
use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class CriteriaUnitTests method shouldBuildIsNotNullCriteria.
// DATAJDBC-513
@Test
void shouldBuildIsNotNullCriteria() {
Criteria criteria = where("foo").isNotNull();
assertThat(criteria.getColumn()).isEqualTo(SqlIdentifier.unquoted("foo"));
assertThat(criteria.getComparator()).isEqualTo(CriteriaDefinition.Comparator.IS_NOT_NULL);
}
use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class CriteriaUnitTests method shouldBuildNotLikeCriteria.
@Test
void shouldBuildNotLikeCriteria() {
Criteria criteria = where("foo").notLike("hello%");
assertThat(criteria.getColumn()).isEqualTo(SqlIdentifier.unquoted("foo"));
assertThat(criteria.getComparator()).isEqualTo(CriteriaDefinition.Comparator.NOT_LIKE);
assertThat(criteria.getValue()).isEqualTo("hello%");
}
use of org.springframework.data.relational.core.query.Criteria in project spring-data-jdbc by spring-projects.
the class CriteriaUnitTests method shouldBuildIsNullCriteria.
// DATAJDBC-513
@Test
void shouldBuildIsNullCriteria() {
Criteria criteria = where("foo").isNull();
assertThat(criteria.getColumn()).isEqualTo(SqlIdentifier.unquoted("foo"));
assertThat(criteria.getComparator()).isEqualTo(CriteriaDefinition.Comparator.IS_NULL);
}
Aggregations