@ -801,7 +801,7 @@ public abstract class ValueNode {
@Override
public String toString() {
return path.toString();
return existsCheck && ! shouldExist ? Utils.concat("!" , path.toString()) : path.toString();
}
public ValueNode evaluate(Predicate.PredicateContext ctx) {
@ -84,6 +84,15 @@ public class FilterCompilerTest {
assertInvalidPathException("[?(!'foo')]");
@Test
// issue #178
public void compile_and_serialize_not_exists_filter(){
Filter compiled = compile("[?(!@.foo)]");
String serialized = compiled.toString();
assertThat(serialized).isEqualTo("[?(!@['foo'])]");
private void assertInvalidPathException(String filter){
try {