public void testQueriesForValueInMapField(Region<Object, Object> region, QueryService qs)
      throws Exception {

    // Empty map
    Portfolio p1 = new Portfolio(1, 1);
    p1.positions = new HashMap<>();
    region.put(1, p1);

    // Map is null
    Portfolio p2 = new Portfolio(2, 2);
    p2.positions = null;
    region.put(2, p2);

    // Map with null value for "SUN" key
    Portfolio p3 = new Portfolio(3, 3);
    p3.positions = new HashMap<>();
    p3.positions.put("IBM", "something");
    p3.positions.put("SUN", null);
    region.put(3, p3);

    // Map with not null value for "SUN" key
    Portfolio p4 = new Portfolio(4, 4);
    p4.positions = new HashMap<>();
    p4.positions.put("SUN", "nothing");
    region.put(4, p4);

    // Map with another value for the "SUN" key
    Portfolio p5 = new Portfolio(5, 5);
    p5.positions = new HashMap<>();
    p5.positions.put("SUN", "more");
    // null is not allowed as key
    p5.positions.put("cannotBeNull", "empty");
    region.put(5, p5);

    // One more with map without the "SUN" key
    Portfolio p6 = new Portfolio(6, 6);
    p6.positions = new HashMap<>();
    p6.positions.put("ERICSSON", "hey");
    region.put(6, p6);

    // Map with a repeated value for the "SUN" key
    Portfolio p7 = new Portfolio(7, 7);
    p7.positions = new HashMap<>();
    p7.positions.put("SUN", "more");
    p7.positions.put("HP", "tip");
    region.put(7, p7);

    String query;
    query = "select * from " + SEPARATOR + "portfolio p where p.positions['SUN'] = null";
    SelectResults<Object> result = UncheckedUtils.uncheckedCast(qs
        .newQuery(query)
        .execute());
    assertThat(result).containsExactlyInAnyOrder(p1, p3, p6);

    query = "select * from " + SEPARATOR + "portfolio p where p.positions['SUN'] != null";
    result = UncheckedUtils.uncheckedCast(qs
        .newQuery(query)
        .execute());
    assertThat(result).containsExactlyInAnyOrder(p2, p4, p5, p7);

    query = "select * from " + SEPARATOR + "portfolio p where p.positions['SUN'] = 'nothing'";
    result = UncheckedUtils.uncheckedCast(qs
        .newQuery(query)
        .execute());
    assertThat(result).containsExactly(p4);

    query = "select * from " + SEPARATOR + "portfolio p where p.positions['SUN'] != 'nothing'";
    result = UncheckedUtils.uncheckedCast(qs
        .newQuery(query)
        .execute());
    assertThat(result).containsExactlyInAnyOrder(p1, p2, p3, p5, p6, p7);

    query = "select * from " + SEPARATOR + "portfolio p";
    result = UncheckedUtils.uncheckedCast(qs
        .newQuery(query)
        .execute());
    assertThat(result).containsExactlyInAnyOrder(p1, p2, p3, p4, p5, p6, p7);
  }
Test index object's comapreTo Function implementation correctness for indexes.
geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/MapRangeIndexMaintenanceJUnitTest.java