private static void nearCache(XmlGenerator gen, String name, NearCacheConfig nearCache) {
        EvictionConfig eviction = nearCache.getEvictionConfig();
        NearCachePreloaderConfig preloader = nearCache.getPreloaderConfig();
        gen.open("near-cache", "name", name)
                .node("in-memory-format", nearCache.getInMemoryFormat())
                .node("serialize-keys", nearCache.isSerializeKeys())
                .node("invalidate-on-change", nearCache.isInvalidateOnChange())
                .node("time-to-live-seconds", nearCache.getTimeToLiveSeconds())
                .node("max-idle-seconds", nearCache.getMaxIdleSeconds())
                .node("local-update-policy", nearCache.getLocalUpdatePolicy())
                .node("eviction", null, "size", eviction.getSize(),
                        "max-size-policy", eviction.getMaxSizePolicy(),
                        "eviction-policy", eviction.getEvictionPolicy(),
                        "comparator-class-name", classNameOrImplClass(
                            eviction.getComparatorClassName(), eviction.getComparator()))
                .node("preloader", null, "enabled", preloader.isEnabled(),
                        "directory", preloader.getDirectory(),
                        "store-initial-delay-seconds", preloader.getStoreInitialDelaySeconds(),
                        "store-interval-seconds", preloader.getStoreIntervalSeconds());
        //close near-cache
        gen.close();
    }
@Test
    public void nearCache() {
        NearCacheConfig expected = createNearCacheConfig(randomString())
                .setPreloaderConfig(
                        new NearCachePreloaderConfig()
                                .setEnabled(true)
                                .setDirectory(randomString())
                                .setStoreInitialDelaySeconds(randomInt())
                                .setStoreIntervalSeconds(randomInt())
                )
                .setEvictionConfig(
                        new EvictionConfig()
                                .setEvictionPolicy(LFU)
                                .setMaxSizePolicy(USED_NATIVE_MEMORY_SIZE)
                                .setComparatorClassName(randomString())
                                .setSize(randomInt())
                );
        clientConfig.addNearCacheConfig(expected);

        Map<String, NearCacheConfig> actual = newConfigViaGenerator().getNearCacheConfigMap();
        assertMap(clientConfig.getNearCacheConfigMap(), actual);
    }