DATACMNS-107 - Added support for True and False as query method keywords.
This commit is contained in:
@@ -187,13 +187,15 @@ public class Part {
|
||||
WITHIN("Within"),
|
||||
REGEX("Regex"),
|
||||
EXISTS(0, "Exists"),
|
||||
TRUE(0, "True"),
|
||||
FALSE(0, "False"),
|
||||
NEGATING_SIMPLE_PROPERTY("Not"),
|
||||
SIMPLE_PROPERTY;
|
||||
|
||||
// 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, LESS_THAN_EQUAL, GREATER_THAN, GREATER_THAN_EQUAL,
|
||||
NOT_LIKE, LIKE, NOT_IN, IN, NEAR, WITHIN, REGEX, EXISTS, NEGATING_SIMPLE_PROPERTY, SIMPLE_PROPERTY);
|
||||
NOT_LIKE, LIKE, NOT_IN, IN, NEAR, WITHIN, REGEX, EXISTS, TRUE, FALSE, NEGATING_SIMPLE_PROPERTY, SIMPLE_PROPERTY);
|
||||
|
||||
private final List<String> keywords;
|
||||
private final int numberOfArguments;
|
||||
|
||||
@@ -259,6 +259,32 @@ public class PartTreeUnitTests {
|
||||
assertThat(part.getParameterRequired(), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-107
|
||||
*/
|
||||
@Test
|
||||
public void parsesTrueKeywordCorrectly() {
|
||||
|
||||
Part part = part("activeTrue");
|
||||
assertThat(part.getType(), is(Type.TRUE));
|
||||
assertThat(part.getProperty().toDotPath(), is("active"));
|
||||
assertThat(part.getNumberOfArguments(), is(0));
|
||||
assertThat(part.getParameterRequired(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-107
|
||||
*/
|
||||
@Test
|
||||
public void parsesFalseKeywordCorrectly() {
|
||||
|
||||
Part part = part("activeTrue");
|
||||
assertThat(part.getType(), is(Type.TRUE));
|
||||
assertThat(part.getProperty().toDotPath(), is("active"));
|
||||
assertThat(part.getNumberOfArguments(), is(0));
|
||||
assertThat(part.getParameterRequired(), is(false));
|
||||
}
|
||||
|
||||
private PartTree partTree(String source) {
|
||||
return new PartTree(source, User.class);
|
||||
}
|
||||
@@ -307,5 +333,6 @@ public class PartTreeUnitTests {
|
||||
String firstname;
|
||||
String lastname;
|
||||
double[] location;
|
||||
boolean active;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user