StrategyStorageWithCacheStrategy implements IResolveDependencyStrategy, IAdditionDependencyStrategy, ICacheable { @Override public void remove(Object key) throws AdditionDependencyStrategyException { try { this.dropCacheFor(key); this.strategyStorage.remove(key); } catch (DropCacheException e) { throw new AdditionDependencyStrategyException(e); } } StrategyStorageWithCacheStrategy(final IFunction argToKeyFunction, final IBiFunction findValueByArgumentFunction); @Override T resolve(Object... args); @Override void register(Object key, IResolveDependencyStrategy value); @Override void remove(Object key); @Override void dropCache(); @Override void dropCacheFor(final Object key);  }
@Test (expected = AdditionDependencyStrategyException.class) public void checkExceptionOnRemove() throws Exception { IResolveDependencyStrategy cachedStrategy = new StrategyStorageWithCacheStrategy(null, null); ((IAdditionDependencyStrategy) cachedStrategy).remove(null); }