PojoSlice implements Slice { public void onStart() { if (target instanceof HazelcastInstanceAware) { ((HazelcastInstanceAware) target).setHazelcastInstance(hazelcastInstance); } if (target instanceof SliceLifecycleListener) { ((SliceLifecycleListener) target).onStart(); } } PojoSlice(Object target);  PojoSlice(Object target, String sliceName);  PojoSlice(Object target, SliceConfig sliceConfig);  PojoSlice(Object target, String sliceName, HazelcastInstance hz); String getName(); HazelcastInstance getHazelcastInstance(); Object getService(String serviceName); void onPartitionAdded(Partition partition); void onPartitionRemoved(Partition partition); void onStart(); void onStop();  }
@Test public void instanceAware_whenTargetImplementsHazelcastInstanceAware() { HazelcastInstanceAware pojo = mock(HazelcastInstanceAware.class); HazelcastInstance hazelcastInstance = null; PojoSlice slice = new PojoSlice(pojo); slice.onStart(); verify(pojo).setHazelcastInstance(hazelcastInstance); verifyNoMoreInteractions(pojo); }