public void testNullSafe() {
    Foo foo = new Foo();

    Map map = new HashMap();
    map.put("foo",
        foo);

    String expression = "foo.?bar.name == null";
    Serializable compiled = compileExpression(expression);

    OptimizerFactory.setDefaultOptimizer("reflective");
    assertEquals(false,
        executeExpression(compiled,
            map));
    foo.setBar(null);
    assertEquals(true,
        executeExpression(compiled,
            map)); // execute a second time (to search for optimizer problems)

    OptimizerFactory.setDefaultOptimizer("ASM");
    compiled = compileExpression(expression);
    foo.setBar(new Bar());
    assertEquals(false,
        executeExpression(compiled,
            map));
    foo.setBar(null);
    assertEquals(true,
        executeExpression(compiled,
            map)); // execute a second time (to search for optimizer problems)

    assertEquals(true,
        eval(expression,
            map));
  }