DATACMNS-78 - Added LessThanEqual and GreaterThanEqual as supported keywords.
This commit is contained in:
@@ -178,8 +178,12 @@ public class Part {
|
||||
IS_NULL(0, "IsNull", "Null"),
|
||||
|
||||
LESS_THAN("LessThan"),
|
||||
|
||||
LESS_THAN_EQUAL("LessThanEqual"),
|
||||
|
||||
GREATER_THAN("GreaterThan"),
|
||||
|
||||
GREATER_THAN_EQUAL("GreaterThanEqual"),
|
||||
|
||||
NOT_LIKE("NotLike"),
|
||||
|
||||
@@ -199,7 +203,7 @@ public class Part {
|
||||
|
||||
// Need to list them again explicitly as the order is important
|
||||
// (esp. for IS_NULL, IS_NOT_NULL)
|
||||
private static final List<Part.Type> ALL = Arrays.asList(IS_NOT_NULL, IS_NULL, BETWEEN, LESS_THAN, GREATER_THAN,
|
||||
private static final List<Part.Type> ALL = Arrays.asList(IS_NOT_NULL, IS_NULL, BETWEEN, LESS_THAN, LESS_THAN_EQUAL, GREATER_THAN, GREATER_THAN_EQUAL,
|
||||
NOT_LIKE, LIKE, NOT_IN, IN, NEAR, WITHIN, NEGATING_SIMPLE_PROPERTY, SIMPLE_PROPERTY);
|
||||
|
||||
private List<String> keywords;
|
||||
|
||||
@@ -184,6 +184,32 @@ public class PartTreeUnitTests {
|
||||
assertThat(parts.next().shouldIgnoreCase(), is(IgnoreCaseType.NEVER));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-78
|
||||
*/
|
||||
@Test
|
||||
public void parsesLessThanEqualCorrectly() {
|
||||
|
||||
PartTree tree = partTree("findByLastnameLessThanEqual");
|
||||
for (Part part : tree.getParts()) {
|
||||
assertThat(part.getType(), is(Type.LESS_THAN_EQUAL));
|
||||
assertThat(part.getProperty(), is(newProperty("lastname")));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-78
|
||||
*/
|
||||
@Test
|
||||
public void parsesGreaterThanEqualCorrectly() {
|
||||
|
||||
PartTree tree = partTree("findByLastnameGreaterThanEqual");
|
||||
for (Part part : tree.getParts()) {
|
||||
assertThat(part.getType(), is(Type.GREATER_THAN_EQUAL));
|
||||
assertThat(part.getProperty(), is(newProperty("lastname")));
|
||||
}
|
||||
}
|
||||
|
||||
private PartTree partTree(String source) {
|
||||
return new PartTree(source, User.class);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user