StrategyStorageStrategy implements IResolveDependencyStrategy, IAdditionDependencyStrategy { @Override public void register(Object arg, IResolveDependencyStrategy value) throws AdditionDependencyStrategyException { try { this.strategyStorage.put(this.argToKeyFunction.execute(arg), value); } catch (InvalidArgumentException | FunctionExecutionException e) { throw new AdditionDependencyStrategyException(e); } } StrategyStorageStrategy(final IFunction argToKeyFunction, final IBiFunction findValueByArgumentFunction); @Override T resolve(Object... args); @Override void register(Object arg, IResolveDependencyStrategy value); @Override void remove(Object arg);  }
@Test (expected = AdditionDependencyStrategyException.class) public void checkExceptionOnRegister() throws Exception { IResolveDependencyStrategy strategy = new StrategyStorageStrategy( (a) -> { throw new InvalidArgumentException(""); }, null ); ((IAdditionDependencyStrategy) strategy).register(null, null); }