private void assertIndexesEqual(QueryCacheConfig queryCacheConfig) {
   Iterator<MapIndexConfig> iterator = queryCacheConfig.getIndexConfigs().iterator();
   while (iterator.hasNext()) {
     MapIndexConfig mapIndexConfig = iterator.next();
     assertEquals("name", mapIndexConfig.getAttribute());
     assertFalse(mapIndexConfig.isOrdered());
   }
 }
  @Test
  public void testFullQueryCacheConfig() throws Exception {
    MapConfig mapConfig = config.getMapConfig("map-with-query-cache");
    QueryCacheConfig queryCacheConfig = mapConfig.getQueryCacheConfigs().get(0);
    EntryListenerConfig entryListenerConfig = queryCacheConfig.getEntryListenerConfigs().get(0);

    assertTrue(entryListenerConfig.isIncludeValue());
    assertFalse(entryListenerConfig.isLocal());

    assertEquals("com.hazelcast.spring.DummyEntryListener", entryListenerConfig.getClassName());
    assertFalse(queryCacheConfig.isIncludeValue());

    assertEquals("my-query-cache-1", queryCacheConfig.getName());
    assertEquals(12, queryCacheConfig.getBatchSize());
    assertEquals(33, queryCacheConfig.getBufferSize());
    assertEquals(12, queryCacheConfig.getDelaySeconds());
    assertEquals(InMemoryFormat.OBJECT, queryCacheConfig.getInMemoryFormat());
    assertTrue(queryCacheConfig.isCoalesce());
    assertFalse(queryCacheConfig.isPopulate());
    assertIndexesEqual(queryCacheConfig);
    assertEquals("__key > 12", queryCacheConfig.getPredicateConfig().getSql());
    assertEquals(EvictionPolicy.LRU, queryCacheConfig.getEvictionConfig().getEvictionPolicy());
    assertEquals(
        EvictionConfig.MaxSizePolicy.ENTRY_COUNT,
        queryCacheConfig.getEvictionConfig().getMaximumSizePolicy());
    assertEquals(111, queryCacheConfig.getEvictionConfig().getSize());
  }
  @Test
  public void testQueryCacheFullConfig() throws Exception {
    QueryCacheConfig queryCacheConfig =
        clientConfig.getQueryCacheConfigs().get("map-name").get("query-cache-name");
    EntryListenerConfig entryListenerConfig = queryCacheConfig.getEntryListenerConfigs().get(0);

    assertEquals("query-cache-name", queryCacheConfig.getName());
    assertTrue(entryListenerConfig.isIncludeValue());
    assertFalse(entryListenerConfig.isLocal());
    assertEquals("com.hazelcast.examples.EntryListener", entryListenerConfig.getClassName());
    assertTrue(queryCacheConfig.isIncludeValue());
    assertEquals(1, queryCacheConfig.getBatchSize());
    assertEquals(16, queryCacheConfig.getBufferSize());
    assertEquals(0, queryCacheConfig.getDelaySeconds());
    assertEquals(EvictionPolicy.LRU, queryCacheConfig.getEvictionConfig().getEvictionPolicy());
    assertEquals(
        EvictionConfig.MaxSizePolicy.ENTRY_COUNT,
        queryCacheConfig.getEvictionConfig().getMaximumSizePolicy());
    assertEquals(10000, queryCacheConfig.getEvictionConfig().getSize());
    assertEquals(InMemoryFormat.BINARY, queryCacheConfig.getInMemoryFormat());
    assertFalse(queryCacheConfig.isCoalesce());
    assertTrue(queryCacheConfig.isPopulate());
    Iterator<MapIndexConfig> iterator = queryCacheConfig.getIndexConfigs().iterator();
    while (iterator.hasNext()) {
      MapIndexConfig mapIndexConfig = iterator.next();
      assertEquals("name", mapIndexConfig.getAttribute());
      assertFalse(mapIndexConfig.isOrdered());
    }

    assertEquals(
        "com.hazelcast.examples.ExamplePredicate",
        queryCacheConfig.getPredicateConfig().getClassName());
  }