/** * Execute {@link Cache#evict(Object)} on the specified {@link Cache} and * invoke the error handler if an exception occurs. */ protected void doEvict(Cache cache, Object key) { try { cache.evict(key); } catch (RuntimeException ex) { getErrorHandler().handleCacheEvictError(ex, cache, key); } }
/** * Execute {@link Cache#evict(Object)} on the specified {@link Cache} and * invoke the error handler if an exception occurs. */ protected void doEvict(Cache cache, Object key) { try { cache.evict(key); } catch (RuntimeException ex) { getErrorHandler().handleCacheEvictError(ex, cache, key); } }
@Test public void evictFail() { UnsupportedOperationException exception = new UnsupportedOperationException("Test exception on evict"); willThrow(exception).given(this.cache).evict(0L); this.simpleService.evict(0L); verify(this.errorHandler).handleCacheEvictError(exception, cache, 0L); }
@Test public void evictFail() { UnsupportedOperationException exception = new UnsupportedOperationException("Test exception on evict"); Object key = SimpleKeyGenerator.generateKey(0L); willThrow(exception).given(this.cache).evict(key); this.simpleService.evict(0L); verify(this.errorHandler).handleCacheEvictError(exception, this.cache, key); }
/** * Execute {@link Cache#evict(Object)} on the specified {@link Cache} and * invoke the error handler if an exception occurs. */ protected void doEvict(Cache cache, Object key) { try { cache.evict(key); } catch (RuntimeException ex) { getErrorHandler().handleCacheEvictError(ex, cache, key); } }