HazelcastCacheService implements ICacheService { @Override public <K, V> ICache<K, V> getCache(final String cacheName) { final ICache<K, V> cache; if (null != hazelcast) { cache = new HazelcastCache<>(hazelcast.getMap(cacheName)); } else { cache = null; } return cache; }  @Override void initialise(final Properties properties); @Override void shutdown(); @Override ICache<K, V> getCache(final String cacheName);  }
@Test public void shouldAllowUserToConfigureCacheUsingConfigFilePath(@TempDir Path tempDir) { initialiseWithTestConfig(tempDir); ICache<String, Integer> cache = service.getCache(CACHE_NAME); assertEquals(0, cache.size()); }
@Test public void shouldReUseCacheIfOneExists(@TempDir Path tempDir) throws CacheOperationException { initialiseWithTestConfig(tempDir); ICache<String, Integer> cache = service.getCache(CACHE_NAME); cache.put("key", 1); ICache<String, Integer> sameCache = service.getCache(CACHE_NAME); assertEquals(1, sameCache.size()); assertEquals(new Integer(1), sameCache.get("key")); }