ReadWriteAccessDelegate extends AbstractAccessDelegate<T> { @Override public boolean afterInsert(final Object key, final Object value, final Object version) throws CacheException { try { return cache.insert(key, value, version); } catch (HazelcastException e) { if (log.isFinestEnabled()) { log.finest("Could not insert into Cache[" + hazelcastRegion.getName() + "]: " + e.getMessage()); } return false; } } ReadWriteAccessDelegate(T hazelcastRegion, final Properties props); @Override boolean afterInsert(final Object key, final Object value, final Object version); @Override boolean afterUpdate(final Object key, final Object value, final Object currentVersion, final Object previousVersion,
                               final SoftLock lock); @Override boolean insert(final Object key, final Object value, final Object version); @Override SoftLock lockItem(final Object key, final Object version); @Override void unlockItem(final Object key, final SoftLock lock); @Override boolean update(Object key, Object value, Object currentVersion, Object previousVersion); @Override void remove(final Object key); @Override void removeAll();  }
@Test public void testAfterInsert() { when(cache.insert(any(), any(), any())).thenThrow(new HazelcastException("expected exception")); assertFalse(delegate.afterInsert(null, null, null)); }