@Test(expectedExceptions = RuntimeException.class) public void testOnMessageShouldThrowRuntimeExceptionWhenObjectMessageNotInstanceOfWilmaHttpEntity() throws JMSException { given(objectMessage.getObject()).willThrow(new JMSException("Can't cast to WilmaHttpEntity!")); underTest.onMessage(objectMessage); }
@Override public void onMessage(final Message message) { if (message instanceof ObjectMessage) { try { WilmaHttpEntity wilmaHttpEntity = getWilmaHttpEntityFromMessage(message); writeFile(message, wilmaHttpEntity); } catch (JMSException e) { throw new RuntimeException(e); } } else { throw new IllegalArgumentException("Message must be of type ObjectMessage"); } }
FileWriterQueueListener implements MessageListener { @Override public void onMessage(final Message message) { if (message instanceof ObjectMessage) { try { WilmaHttpEntity wilmaHttpEntity = getWilmaHttpEntityFromMessage(message); writeFile(message, wilmaHttpEntity); } catch (JMSException e) { throw new RuntimeException(e); } } else { throw new IllegalArgumentException("Message must be of type ObjectMessage"); } } }
FileWriterQueueListener implements MessageListener { @Override public void onMessage(final Message message) { if (message instanceof ObjectMessage) { try { WilmaHttpEntity wilmaHttpEntity = getWilmaHttpEntityFromMessage(message); writeFile(message, wilmaHttpEntity); } catch (JMSException e) { throw new RuntimeException(e); } } else { throw new IllegalArgumentException("Message must be of type ObjectMessage"); } }  }
FileWriterQueueListener implements MessageListener { @Override public void onMessage(final Message message) { if (message instanceof ObjectMessage) { try { WilmaHttpEntity wilmaHttpEntity = getWilmaHttpEntityFromMessage(message); writeFile(message, wilmaHttpEntity); } catch (JMSException e) { throw new RuntimeException(e); } } else { throw new IllegalArgumentException("Message must be of type ObjectMessage"); } }  @Override void onMessage(final Message message); }
FileWriterQueueListener implements MessageListener { @Override public void onMessage(final Message message) { if (message instanceof ObjectMessage) { try { WilmaHttpEntity wilmaHttpEntity = getWilmaHttpEntityFromMessage(message); writeFile(message, wilmaHttpEntity); } catch (JMSException e) { throw new RuntimeException(e); } } else { throw new IllegalArgumentException("Message must be of type ObjectMessage"); } }  @Override void onMessage(final Message message);  }