@Test public void shouldReadPendingOrderConditionalyClosedMessagesCorrectly() throws CommunicationException { when(client.tryReceiveByte()).thenReturn(MessageType.PENDING_ORDER_CONDITIONALY_CLOSED.getMessageNumber()); when(client.tryReceiveInteger()).thenReturn(6554); when(client.tryReceiveLong()).thenReturn(3421342L); when(client.tryReceiveDouble()).thenReturn(32.421); final PendingOrderConditionalyClosedMessage message = cut .readMessage(PendingOrderConditionalyClosedMessage.class); assertThat(message.getOrderId()).isEqualTo(6554); assertThat(message.getTime().getEpochSecond()).isEqualTo(3421342L); assertThat(message.getPrice()).isEqualTo(new Price(32.421)); }
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();  }