@Test public void canceledFirstOrderAllowsFurtherOrders() { final OrderManagement firstOrder = cut.sendOrder(someOrder, someEventListener); firstOrder.closeOrCancelOrder(); cut.sendOrder(someOrder, someEventListener); verifyNoMoreInteractions(someEventListener); }
@Override public OrderManagement sendOrder(final BasicPendingOrder order, final OrderEventListener eventListener) { if (tradeUnblocker != null) { eventListener.orderRejected(FAILED); return NO_OP_ORDER_MANAGEMENT; } this.tradeUnblocker = new TradeUnblocker(eventListener); final OrderManagement originalOrderManagement = broker.sendOrder(order, tradeUnblocker); if (tradeUnblocker == null) { return NO_OP_ORDER_MANAGEMENT; } else { tradeUnblocker.setOrderManagement(originalOrderManagement); return tradeUnblocker; } }
SingleTradeBroker implements Broker<BasicPendingOrder> { @Override public OrderManagement sendOrder(final BasicPendingOrder order, final OrderEventListener eventListener) { if (tradeUnblocker != null) { eventListener.orderRejected(FAILED); return NO_OP_ORDER_MANAGEMENT; } this.tradeUnblocker = new TradeUnblocker(eventListener); final OrderManagement originalOrderManagement = broker.sendOrder(order, tradeUnblocker); if (tradeUnblocker == null) { return NO_OP_ORDER_MANAGEMENT; } else { tradeUnblocker.setOrderManagement(originalOrderManagement); return tradeUnblocker; } } }
SingleTradeBroker implements Broker<BasicPendingOrder> { @Override public OrderManagement sendOrder(final BasicPendingOrder order, final OrderEventListener eventListener) { if (tradeUnblocker != null) { eventListener.orderRejected(FAILED); return NO_OP_ORDER_MANAGEMENT; } this.tradeUnblocker = new TradeUnblocker(eventListener); final OrderManagement originalOrderManagement = broker.sendOrder(order, tradeUnblocker); if (tradeUnblocker == null) { return NO_OP_ORDER_MANAGEMENT; } else { tradeUnblocker.setOrderManagement(originalOrderManagement); return tradeUnblocker; } } SingleTradeBroker(final Broker<BasicPendingOrder> broker); }
SingleTradeBroker implements Broker<BasicPendingOrder> { @Override public OrderManagement sendOrder(final BasicPendingOrder order, final OrderEventListener eventListener) { if (tradeUnblocker != null) { eventListener.orderRejected(FAILED); return NO_OP_ORDER_MANAGEMENT; } this.tradeUnblocker = new TradeUnblocker(eventListener); final OrderManagement originalOrderManagement = broker.sendOrder(order, tradeUnblocker); if (tradeUnblocker == null) { return NO_OP_ORDER_MANAGEMENT; } else { tradeUnblocker.setOrderManagement(originalOrderManagement); return tradeUnblocker; } } SingleTradeBroker(final Broker<BasicPendingOrder> broker); @Override OrderManagement sendOrder(final BasicPendingOrder order,
            final OrderEventListener eventListener); }
SingleTradeBroker implements Broker<BasicPendingOrder> { @Override public OrderManagement sendOrder(final BasicPendingOrder order, final OrderEventListener eventListener) { if (tradeUnblocker != null) { eventListener.orderRejected(FAILED); return NO_OP_ORDER_MANAGEMENT; } this.tradeUnblocker = new TradeUnblocker(eventListener); final OrderManagement originalOrderManagement = broker.sendOrder(order, tradeUnblocker); if (tradeUnblocker == null) { return NO_OP_ORDER_MANAGEMENT; } else { tradeUnblocker.setOrderManagement(originalOrderManagement); return tradeUnblocker; } } SingleTradeBroker(final Broker<BasicPendingOrder> broker); @Override OrderManagement sendOrder(final BasicPendingOrder order,
            final OrderEventListener eventListener);  }