DATAKV-185 - Polishing.

Fix NPE by now returning an expression that always resolves to true.
This commit is contained in:
Christoph Strobl
2017-07-04 22:02:14 +02:00
parent b99510b6e1
commit 256bb16dba
2 changed files with 11 additions and 1 deletions

View File

@@ -306,6 +306,13 @@ public class SpelQueryCreatorUnitTests {
assertThat(evaluate("findByFirstnameIn", list).against(new Person(null, 10)), is(true));
}
@Test // DATAKV-185
public void noDerivedQueryArgumentsMatchesAlways() throws Exception {
assertThat(evaluate("findBy").against(JON), is(true));
assertThat(evaluate("findBy").against(null), is(true));
}
private Evaluation evaluate(String methodName, Object... args) throws Exception {
return new Evaluation((SpelExpression) createQueryForMethodWithArgs(methodName, args).getCriteria());
}
@@ -336,6 +343,9 @@ public class SpelQueryCreatorUnitTests {
static interface PersonRepository {
// No arguments
Person findBy();
// Type.SIMPLE_PROPERTY
Person findByFirstname(String firstname);