DATACMNS-1578 - Proper handling of null values in QuerydslDefaultBinding.
We now properly use an ….isNull() binding if the value to be compared to is null.
This commit is contained in:
committed by
Oliver Drotbohm
parent
3ebe74d018
commit
30dbac1bce
@@ -30,6 +30,7 @@ import com.querydsl.core.types.Predicate;
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @author Oliver Gierke
|
||||
* @author Colin Gao
|
||||
*/
|
||||
public class QuerydslDefaultBindingUnitTests {
|
||||
|
||||
@@ -76,4 +77,10 @@ public class QuerydslDefaultBindingUnitTests {
|
||||
public void testname() {
|
||||
assertThat(binding.bind(QUser.user.lastname, Collections.emptySet())).isNotPresent();
|
||||
}
|
||||
|
||||
@Test //DATACMNS-1578
|
||||
public void shouldCreatePredicateWithIsNullWhenPropertyIsAnNestedObjectAndValueIsNull() {
|
||||
Optional<Predicate> predicate = binding.bind(QUser.user.address.city, Collections.singleton(null));
|
||||
assertThat(predicate).hasValueSatisfying(it -> assertThat(it.toString()).isEqualTo(QUser.user.address.city.isNull().toString()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user