private void likePercentageTerminated_5(boolean useBindPrm) throws Exception {
    Cache cache = CacheUtils.getCache();
    AttributesFactory attributesFactory = new AttributesFactory();
    RegionAttributes regionAttributes = attributesFactory.create();

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

    char ch = 'd';
    String base = "abc";
    for (int i = 1; i < 6; ++i) {
      Portfolio pf = new Portfolio(i);
      pf.status = base + ch;
      ch += 1;
      region.put(i, pf);
    }

    QueryService qs = cache.getQueryService();

    String predicate = "";
    if (useBindPrm) {
      predicate = "$1";
    } else {
      predicate = " 'a%c%'";
    }
    Query q = qs.newQuery(
        "SELECT distinct *  FROM " + SEPARATOR + "pos ps WHERE ps.status like " + predicate);

    SelectResults results;
    if (useBindPrm) {
      results = (SelectResults) q.execute(new Object[] {"a%bc%"});
    } else {
      results = (SelectResults) q.execute();
    }

    ResultsBag bag = new ResultsBag(null);
    for (int i = 1; i < 6; ++i) {
      bag.add(region.get(i));
    }
    SelectResults expectedResults =
        new ResultsCollectionWrapper(new ObjectTypeImpl(Object.class), bag.asSet());
    SelectResults[][] rs = new SelectResults[][] {{results, expectedResults}};
    CacheUtils.compareResultsOfWithAndWithoutIndex(rs, this);
    // Create Index
    qs.createIndex("status", IndexType.FUNCTIONAL, "ps.status", SEPARATOR + "pos ps");

    q = qs.newQuery(
        "SELECT distinct *  FROM " + SEPARATOR + "pos ps WHERE ps.status like " + predicate);

    if (useBindPrm) {
      results = (SelectResults) q.execute(new Object[] {"a%bc%"});
    } else {
      results = (SelectResults) q.execute();
    }

    rs = new SelectResults[][] {{results, expectedResults}};
    CacheUtils.compareResultsOfWithAndWithoutIndex(rs, this);

    if (useBindPrm) {
      predicate = "$1";
    } else {
      predicate = "'abc_'";
    }
    q = qs.newQuery(
        "SELECT distinct *  FROM " + SEPARATOR + "pos ps WHERE ps.status like " + predicate);

    if (useBindPrm) {
      results = (SelectResults) q.execute(new Object[] {"abc_"});
    } else {
      results = (SelectResults) q.execute();
    }

    rs = new SelectResults[][] {{results, expectedResults}};
    CacheUtils.compareResultsOfWithAndWithoutIndex(rs, this);

    if (useBindPrm) {
      predicate = "$1";
    } else {
      predicate = "'_bc_'";
    }
    q = qs.newQuery(
        "SELECT distinct *  FROM " + SEPARATOR + "pos ps WHERE ps.status like " + predicate);
    if (useBindPrm) {
      results = (SelectResults) q.execute(new Object[] {"_bc_"});
    } else {
      results = (SelectResults) q.execute();
    }

    rs = new SelectResults[][] {{results, expectedResults}};
    CacheUtils.compareResultsOfWithAndWithoutIndex(rs, this);
  }
Tests a simple % terminated like predicate with an AND condition
geode-core/src/integrationTest/java/org/apache/geode/cache/query/functional/LikePredicateJUnitTest.java