DATACMNS-1007 - Polishing.

Moved the enum declaration to a more appropriate position. Moved the author addition to the part of the codebase that was actually changed. Expanded copyright year.

Moved unit tests to more appropriate position. Added another one to make sure a reference to a boolean property "empty" can still be supported by adding an explicit Is to make sure we detect a simple property reference.

Original pull request: #203.
This commit is contained in:
Oliver Gierke
2017-03-13 12:50:58 +01:00
parent 760f09a059
commit d98c0df40b
2 changed files with 26 additions and 18 deletions

View File

@@ -222,16 +222,6 @@ 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);
@@ -577,6 +567,23 @@ public class PartTreeUnitTests {
assertThat(part.getProperty(), is(PropertyPath.from("someInfo", Category.class)));
}
@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-1007
public void parsesEmptyAsPropertyIfDifferentKeywordIsUsed() {
assertType(asList("emptyIsTrue"), TRUE, "empty", 0, false);
assertType(asList("emptyIs"), SIMPLE_PROPERTY, "empty", 1, true);
}
private static void assertLimiting(String methodName, Class<?> entityType, boolean limiting, Integer maxResults) {
assertLimiting(methodName, entityType, limiting, maxResults, false);
}
@@ -663,6 +670,7 @@ public class PartTreeUnitTests {
boolean active;
Date birthday;
List<User> friends;
boolean empty;
}
class Organization {