use of com.hazelcast.cache.impl.HazelcastInstanceCacheManager in project hazelcast by hazelcast.
the class CacheThroughHazelcastInstanceTest method getCache_whenOtherHazelcastExceptionIsThrown_thenFail.
@Test
public void getCache_whenOtherHazelcastExceptionIsThrown_thenFail() {
// when one attempts to getCache but a HazelcastException other than ServiceNotFoundException is thrown
HazelcastInstanceImpl hzInstanceImpl = mock(HazelcastInstanceImpl.class);
when(hzInstanceImpl.getDistributedObject(anyString(), anyString())).thenThrow(new HazelcastException("mock hz exception"));
// then the thrown HazelcastException is rethrown by getCache
ICacheManager hzCacheManager = new HazelcastInstanceCacheManager(hzInstanceImpl);
thrown.expect(HazelcastException.class);
hzCacheManager.getCache("any-cache");
}
Aggregations