### Question:
WebsphereMQProvider implements JmsProvider { @Override public Destination getDestination( JmsDelegate meta, VariableSpace variableSpace ) { checkNotNull( meta.destinationName, getString( JmsConstants.PKG, "JmsWebsphereMQ.DestinationNameRequired" ) ); try { String destName = variableSpace.environmentSubstitute( meta.destinationName ); return isQueue( meta, variableSpace ) ? new MQQueue( destName ) : new MQTopic( destName ); } catch ( JMSException e ) { throw new RuntimeException( e ); } }  @Override boolean supports( ConnectionType type ); @Override JMSContext getContext( JmsDelegate meta, VariableSpace variableSpace ); @Override Destination getDestination( JmsDelegate meta,
                                               VariableSpace variableSpace );  }### Answer:
@Test public void getQueueDestination() { jmsDelegate.destinationType = QUEUE.name(); jmsDelegate.destinationName = "somename"; Destination dest = jmsProvider.getDestination( jmsDelegate, variableSpace ); assertTrue( dest instanceof Queue ); }
@Test public void getTopicDestination() { jmsDelegate.destinationType = TOPIC.name(); jmsDelegate.destinationName = "somename"; Destination dest = jmsProvider.getDestination( jmsDelegate, variableSpace ); assertTrue( dest instanceof Topic ); }
@Test public void noDestinationNameSetCausesError() { jmsDelegate.destinationType = QUEUE.name(); jmsDelegate.destinationName = null; try { jmsProvider.getDestination( jmsDelegate, variableSpace ); fail(); } catch ( Exception e ) { assertTrue( e.getMessage().contains( "Destination name must be set." ) ); } }