Skip to content

Commit

Permalink
DATACMNS-78 - Added LessThanEqual and GreaterThanEqual as supported k…
Browse files Browse the repository at this point in the history
…eywords.
  • Loading branch information
odrotbohm committed Sep 27, 2011
1 parent 4ee29c5 commit 61bf243
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
Expand Up @@ -178,8 +178,12 @@ public static enum Type {
IS_NULL(0, "IsNull", "Null"),

LESS_THAN("LessThan"),

LESS_THAN_EQUAL("LessThanEqual"),

GREATER_THAN("GreaterThan"),

GREATER_THAN_EQUAL("GreaterThanEqual"),

NOT_LIKE("NotLike"),

Expand All @@ -199,7 +203,7 @@ public static enum Type {

// 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;
Expand Down
Expand Up @@ -184,6 +184,32 @@ public void detectsSpecificIgnoringCase() throws Exception {
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);
}
Expand Down

0 comments on commit 61bf243

Please sign in to comment.