diff --git a/json-path/src/test/java/com/jayway/jsonpath/FilterTest.java b/json-path/src/test/java/com/jayway/jsonpath/FilterTest.java index d1aafce4..da6b87a2 100644 --- a/json-path/src/test/java/com/jayway/jsonpath/FilterTest.java +++ b/json-path/src/test/java/com/jayway/jsonpath/FilterTest.java @@ -370,7 +370,7 @@ public class FilterTest extends BaseTest { //---------------------------------------------------------------------------- // - // EMPTY + // NOT EMPTY // //---------------------------------------------------------------------------- @Test @@ -384,6 +384,29 @@ public class FilterTest extends BaseTest { assertThat(filter(where("null-key").notEmpty()).apply(createPredicateContext(json))).isEqualTo(false); } + //---------------------------------------------------------------------------- + // + // EMPTY + // + //---------------------------------------------------------------------------- + @Test + public void empty_evals() { + assertThat(filter(where("string-key").empty(false)).apply(createPredicateContext(json))).isEqualTo(true); + assertThat(filter(where("string-key").empty(true)).apply(createPredicateContext(json))).isEqualTo(false); + + assertThat(filter(where("string-key-empty").empty(true)).apply(createPredicateContext(json))).isEqualTo(true); + assertThat(filter(where("string-key-empty").empty(false)).apply(createPredicateContext(json))).isEqualTo(false); + + assertThat(filter(where("int-arr").empty(false)).apply(createPredicateContext(json))).isEqualTo(true); + assertThat(filter(where("int-arr").empty(true)).apply(createPredicateContext(json))).isEqualTo(false); + + assertThat(filter(where("arr-empty").empty(true)).apply(createPredicateContext(json))).isEqualTo(true); + assertThat(filter(where("arr-empty").empty(false)).apply(createPredicateContext(json))).isEqualTo(false); + + assertThat(filter(where("null-key").empty(true)).apply(createPredicateContext(json))).isEqualTo(false); + assertThat(filter(where("null-key").empty(false)).apply(createPredicateContext(json))).isEqualTo(false); + } + //---------------------------------------------------------------------------- //