private void enhancedNotLike(boolean useBindPrms, boolean useIndex) throws Exception {
    Cache cache = CacheUtils.getCache();
    AttributesFactory attributesFactory = new AttributesFactory();
    RegionAttributes regionAttributes = attributesFactory.create();

    Region region = cache.createRegion("pos", regionAttributes);

    String[] values = new String[] {"active", "inactive",};

    for (int i = 0; i < values.length; i++) {
      region.put(i, values[i]);
    }

    QueryService qs = cache.getQueryService();

    if (useIndex) {
      qs.createIndex("p", IndexType.FUNCTIONAL, "p", SEPARATOR + "pos.values p");
    }
    Query q;
    SelectResults results;

    String[] likePredicates1 = new String[] {"active", "act%%ve", "a%e", "activ_", "ac_ive",
        "act__e", "a%iv_", "a_tiv%", "ac%",};
    for (final String item : likePredicates1) {
      if (!useBindPrms) {
        q = qs.newQuery(
            "select p from " + SEPARATOR + "pos p where NOT (p like '" + item + "')");
        results = (SelectResults) q.execute();
      } else {
        q = qs.newQuery("select p from " + SEPARATOR + "pos p where NOT (p like $1)");
        results = (SelectResults) q.execute(new Object[] {item});
      }
      List r = results.asList();
      if (r.size() != 1 || !r.get(0).equals(values[1])) {
        fail("Unexprected result. expected :" + values[1] + " for the like predicate1: "
            + item + " found : "
            + (r.size() == 1 ? r.get(0) : "Result size not equal to 1"));
      }
    }

    String[] likePredicates2 = new String[] {"%ctiv%", "%c%iv%", "%ctive", "%%ti%", "%",};
    for (final String value : likePredicates2) {
      if (!useBindPrms) {
        q = qs.newQuery(
            "select p from " + SEPARATOR + "pos p where NOT (p like '" + value + "')");
        results = (SelectResults) q.execute();
      } else {
        q = qs.newQuery("select p from " + SEPARATOR + "pos p where NOT (p like $1)");
        results = (SelectResults) q.execute(new Object[] {value});
      }
      List r = results.asList();
      if (r.size() != 0) {
        fail("Unexprected result. expected nothing for the like predicate2: " + value
            + " found : " + (r.size() != 0 ? r.get(0) + " Result size not equal to 0" : ""));
      }
    }

    String[] likePredicates3 = new String[] {"___ctive", "___c_iv_", "___ctiv%", "____tive",};
    for (final String s : likePredicates3) {
      if (!useBindPrms) {
        q = qs.newQuery(
            "select p from " + SEPARATOR + "pos p where NOT (p like '" + s + "')");
        results = (SelectResults) q.execute();
      } else {
        q = qs.newQuery("select p from " + SEPARATOR + "pos p where NOT (p like $1)");
        results = (SelectResults) q.execute(new Object[] {s});
      }
      List r = results.asList();
      if (r.size() != 1 || !r.get(0).equals(values[0])) {
        fail("Unexprected result. expected :" + values[0] + " for the like predicate3: "
            + s + " found : "
            + (r.size() == 1 ? r.get(0) : "Result size not equal to 1"));
      }
    }
  }
Tests with combination of % and _ and NOT with LIKE Supported from 6.6
geode-core/src/integrationTest/java/org/apache/geode/cache/query/functional/LikePredicateJUnitTest.java