DATACMNS-1007 - Added IsEmpty and IsNotEmpty keywords to query parser.

The query derivation mechanism now detects IsEmpty and NotIsEmpty as keywords and exposes them in the PartTree.

Original pull request: #203.
This commit is contained in:
Michael Cramer
2017-03-10 16:54:47 +01:00
committed by Oliver Gierke
parent be4498659d
commit 760f09a059
3 changed files with 20 additions and 3 deletions

View File

@@ -45,6 +45,7 @@ import org.springframework.data.repository.query.parser.PartTree.OrPart;
* @author Martin Baumgartner
* @author Christoph Strobl
* @author Mark Paluch
* @author Michael Cramer
*/
public class PartTreeUnitTests {
@@ -221,6 +222,16 @@ public class PartTreeUnitTests {
assertThat(parts, is(hasSize(1)));
}
@Test // DATACMNS-1007
public void parsesEmptyKeywordCorrectly() {
assertType(asList("friendsIsEmpty", "friendsEmpty"), IS_EMPTY, "friends", 0, false);
}
@Test // DATACMNS-1007
public void parsesNotEmptyKeywordCorrectly() {
assertType(asList("friendsIsNotEmpty", "friendsNotEmpty"), IS_NOT_EMPTY, "friends", 0, false);
}
@Test // DATACMNS-94
public void parsesExistsKeywordCorrectly() {
assertType(asList("lastnameExists"), EXISTS, "lastname", 0, false);
@@ -651,6 +662,7 @@ public class PartTreeUnitTests {
double[] location;
boolean active;
Date birthday;
List<User> friends;
}
class Organization {