@Test(expected = ProtocolException.class) public void shouldFailWhenUnknownOrderWasClosed() throws CommunicationException { when(pendingOrderMapper.has(EXAMPLE_PENDING_ORDER_ID)).thenReturn(false); final Price examplePrice = new Price(5.48); final Instant exampleTime = LocalDateTime.of(2014, 07, 13, 15, 32, 23).toInstant(ZoneOffset.UTC); final PendingOrderConditionalyClosedMessage message = new PendingOrderConditionalyClosedMessage( EXAMPLE_PENDING_ORDER_ID, exampleTime, examplePrice); cut.handleMessage(message); }
public void handleMessage(final Message message) throws ProtocolException { if (message instanceof NewMarketDataExtendedMessage) { handle((NewMarketDataExtendedMessage) message); } else if (message instanceof AccountCurrencyExchangeRateChangedMessage) { handle((AccountCurrencyExchangeRateChangedMessage) message); } else if (message instanceof PendingOrderConditionalyExecutedMessage) { handle((PendingOrderConditionalyExecutedMessage) message); } else if (message instanceof PendingOrderConditionalyClosedMessage) { handle((PendingOrderConditionalyClosedMessage) message); } else if (message instanceof BalanceChangedMessage) { handle((BalanceChangedMessage) message); } else { throw new ProtocolException("Received a message of type '" + message.getClass().getSimpleName() + "' which was not expected for the expert advisor protocol."); } }
LocalExpertAdvisor { public void handleMessage(final Message message) throws ProtocolException { if (message instanceof NewMarketDataExtendedMessage) { handle((NewMarketDataExtendedMessage) message); } else if (message instanceof AccountCurrencyExchangeRateChangedMessage) { handle((AccountCurrencyExchangeRateChangedMessage) message); } else if (message instanceof PendingOrderConditionalyExecutedMessage) { handle((PendingOrderConditionalyExecutedMessage) message); } else if (message instanceof PendingOrderConditionalyClosedMessage) { handle((PendingOrderConditionalyClosedMessage) message); } else if (message instanceof BalanceChangedMessage) { handle((BalanceChangedMessage) message); } else { throw new ProtocolException("Received a message of type '" + message.getClass().getSimpleName() + "' which was not expected for the expert advisor protocol."); } } }
LocalExpertAdvisor { public void handleMessage(final Message message) throws ProtocolException { if (message instanceof NewMarketDataExtendedMessage) { handle((NewMarketDataExtendedMessage) message); } else if (message instanceof AccountCurrencyExchangeRateChangedMessage) { handle((AccountCurrencyExchangeRateChangedMessage) message); } else if (message instanceof PendingOrderConditionalyExecutedMessage) { handle((PendingOrderConditionalyExecutedMessage) message); } else if (message instanceof PendingOrderConditionalyClosedMessage) { handle((PendingOrderConditionalyClosedMessage) message); } else if (message instanceof BalanceChangedMessage) { handle((BalanceChangedMessage) message); } else { throw new ProtocolException("Received a message of type '" + message.getClass().getSimpleName() + "' which was not expected for the expert advisor protocol."); } } LocalExpertAdvisor(final ExpertAdvisor<FullMarketData<M1>> expertAdvisor,
            final AccountBalanceManager accountBalanceManager, final PendingOrderMapper orderMapper,
            final Currency balanceCurrency, final ForexSymbol accountCurrencyExchangeSymbol); }
LocalExpertAdvisor { public void handleMessage(final Message message) throws ProtocolException { if (message instanceof NewMarketDataExtendedMessage) { handle((NewMarketDataExtendedMessage) message); } else if (message instanceof AccountCurrencyExchangeRateChangedMessage) { handle((AccountCurrencyExchangeRateChangedMessage) message); } else if (message instanceof PendingOrderConditionalyExecutedMessage) { handle((PendingOrderConditionalyExecutedMessage) message); } else if (message instanceof PendingOrderConditionalyClosedMessage) { handle((PendingOrderConditionalyClosedMessage) message); } else if (message instanceof BalanceChangedMessage) { handle((BalanceChangedMessage) message); } else { throw new ProtocolException("Received a message of type '" + message.getClass().getSimpleName() + "' which was not expected for the expert advisor protocol."); } } LocalExpertAdvisor(final ExpertAdvisor<FullMarketData<M1>> expertAdvisor,
            final AccountBalanceManager accountBalanceManager, final PendingOrderMapper orderMapper,
            final Currency balanceCurrency, final ForexSymbol accountCurrencyExchangeSymbol); void handleMessage(final Message message); }
LocalExpertAdvisor { public void handleMessage(final Message message) throws ProtocolException { if (message instanceof NewMarketDataExtendedMessage) { handle((NewMarketDataExtendedMessage) message); } else if (message instanceof AccountCurrencyExchangeRateChangedMessage) { handle((AccountCurrencyExchangeRateChangedMessage) message); } else if (message instanceof PendingOrderConditionalyExecutedMessage) { handle((PendingOrderConditionalyExecutedMessage) message); } else if (message instanceof PendingOrderConditionalyClosedMessage) { handle((PendingOrderConditionalyClosedMessage) message); } else if (message instanceof BalanceChangedMessage) { handle((BalanceChangedMessage) message); } else { throw new ProtocolException("Received a message of type '" + message.getClass().getSimpleName() + "' which was not expected for the expert advisor protocol."); } } LocalExpertAdvisor(final ExpertAdvisor<FullMarketData<M1>> expertAdvisor,
            final AccountBalanceManager accountBalanceManager, final PendingOrderMapper orderMapper,
            final Currency balanceCurrency, final ForexSymbol accountCurrencyExchangeSymbol); void handleMessage(final Message message);  }