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:
Colin Gao
2019-09-04 07:38:41 +12:00
committed by Oliver Drotbohm
parent 3ebe74d018
commit 30dbac1bce
2 changed files with 16 additions and 1 deletions

View File

@@ -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()));
}
}