@Test(expected = IllegalArgumentException.class) public void failsWhenBlockingAnAlreadyBlockedCurrency() { cut.blockCurrencies(new ForexSymbol("EURUSD")); cut.blockCurrencies(new ForexSymbol("EURCHF")); }
@Override public void blockCurrencies(final ForexSymbol symbol) { if (!isTradingAllowed(symbol)) { throw new IllegalArgumentException("Should block the currencies of symbol " + symbol + " from trading but one or both currencies are already blocked."); } currenciesInvestedIn.add(symbol.getBaseCurrency()); currenciesInvestedIn.add(symbol.getQuoteCurrency()); }
OneTradePerCurrency implements TradeBlocker { @Override public void blockCurrencies(final ForexSymbol symbol) { if (!isTradingAllowed(symbol)) { throw new IllegalArgumentException("Should block the currencies of symbol " + symbol + " from trading but one or both currencies are already blocked."); } currenciesInvestedIn.add(symbol.getBaseCurrency()); currenciesInvestedIn.add(symbol.getQuoteCurrency()); } }
OneTradePerCurrency implements TradeBlocker { @Override public void blockCurrencies(final ForexSymbol symbol) { if (!isTradingAllowed(symbol)) { throw new IllegalArgumentException("Should block the currencies of symbol " + symbol + " from trading but one or both currencies are already blocked."); } currenciesInvestedIn.add(symbol.getBaseCurrency()); currenciesInvestedIn.add(symbol.getQuoteCurrency()); }  }
OneTradePerCurrency implements TradeBlocker { @Override public void blockCurrencies(final ForexSymbol symbol) { if (!isTradingAllowed(symbol)) { throw new IllegalArgumentException("Should block the currencies of symbol " + symbol + " from trading but one or both currencies are already blocked."); } currenciesInvestedIn.add(symbol.getBaseCurrency()); currenciesInvestedIn.add(symbol.getQuoteCurrency()); }  @Override boolean isTradingAllowed(final ForexSymbol symbol); @Override void blockCurrencies(final ForexSymbol symbol); @Override void unblockCurrencies(final ForexSymbol symbol); }
OneTradePerCurrency implements TradeBlocker { @Override public void blockCurrencies(final ForexSymbol symbol) { if (!isTradingAllowed(symbol)) { throw new IllegalArgumentException("Should block the currencies of symbol " + symbol + " from trading but one or both currencies are already blocked."); } currenciesInvestedIn.add(symbol.getBaseCurrency()); currenciesInvestedIn.add(symbol.getQuoteCurrency()); }  @Override boolean isTradingAllowed(final ForexSymbol symbol); @Override void blockCurrencies(final ForexSymbol symbol); @Override void unblockCurrencies(final ForexSymbol symbol);  }