use of com.hazelcast.spi.exception.ServiceNotFoundException in project hazelcast by hazelcast.
the class ClientICacheManagerTest method getCache_when_serviceNotFoundExceptionIsThrown_then_illegalStateExceptionIsThrown.
@Test
public void getCache_when_serviceNotFoundExceptionIsThrown_then_illegalStateExceptionIsThrown() {
// when HazelcastException with ServiceNotFoundException cause was thrown by hzInstance.getDistributedObject
// (i.e. cache support is not available server-side)
HazelcastInstance hzInstance = mock(HazelcastInstance.class);
HazelcastException hzException = new HazelcastException("mock exception", new ServiceNotFoundException("mock exception"));
when(hzInstance.getDistributedObject(anyString(), anyString())).thenThrow(hzException);
ClientICacheManager clientCacheManager = new ClientICacheManager(hzInstance);
// then an IllegalStateException will be thrown by getCache
thrown.expect(IllegalStateException.class);
clientCacheManager.getCache("any-cache");
}
Aggregations