/** * Tests onMessage method. * * @throws JMSException */ @Test(expected = RuntimeException.class) public void onMessageWithWrongMessageClass() { incomingQueueMDB.onMessage(objMessage); }
/** * Tests onMessage method with JMSException. * * @throws JMSException */ @Test(expected = RuntimeException.class) public void onMessageWithJMSException() throws JMSException { when(textMessage.getText()).thenThrow(new JMSException("Test Exception")); incomingQueueMDB.onMessage(textMessage); }