@Test public void shouldReadAccountCurrencyExchangeRateChangedMessageCorrectly() throws CommunicationException { when(client.tryReceiveByte()).thenReturn(MessageType.ACCOUNT_CURRENCY_EXCHANGE_RATE_CHANGED.getMessageNumber()); when(client.tryReceiveDouble()).thenReturn(1.5); final AccountCurrencyExchangeRateChangedMessage message = cut .readMessage(AccountCurrencyExchangeRateChangedMessage.class); assertThat(message.getNewRate()).isEqualTo(new Price(1.5)); }
public Message readMessage() throws CommunicationException { return readMessage(readMessageTypeOrFail()); }
MessageBasedClientConnection { public Message readMessage() throws CommunicationException { return readMessage(readMessageTypeOrFail()); } }
MessageBasedClientConnection { public Message readMessage() throws CommunicationException { return readMessage(readMessageTypeOrFail()); } MessageBasedClientConnection(final ClientConnection connection); }
MessageBasedClientConnection { public Message readMessage() throws CommunicationException { return readMessage(readMessageTypeOrFail()); } MessageBasedClientConnection(final ClientConnection connection); Message readMessage(); @SuppressWarnings("unchecked") M readMessage(final Class<M> messageClass); void sendMessage(final Message message); @Override String toString(); }
MessageBasedClientConnection { public Message readMessage() throws CommunicationException { return readMessage(readMessageTypeOrFail()); } MessageBasedClientConnection(final ClientConnection connection); Message readMessage(); @SuppressWarnings("unchecked") M readMessage(final Class<M> messageClass); void sendMessage(final Message message); @Override String toString();  }