### Question:
JmsPoolTopicPublisher extends JmsPoolMessageProducer implements TopicPublisher, AutoCloseable { public TopicPublisher getTopicPublisher() throws JMSException { return (TopicPublisher) getMessageProducer(); } JmsPoolTopicPublisher(JmsPoolSession session, TopicPublisher messageProducer, Destination destination, AtomicInteger refCount); @Override Topic getTopic(); @Override void publish(Message message); @Override void publish(Message message, int deliveryMode, int priority, long timeToLive); @Override void publish(Topic topic, Message message); @Override void publish(Topic topic, Message message, int deliveryMode, int priority, long timeToLive); @Override String toString(); TopicPublisher getTopicPublisher();  }### Answer:
@Test public void testGetTopicPublisher() throws JMSException { JmsPoolConnection connection = (JmsPoolConnection) cf.createTopicConnection(); TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); Topic topic = session.createTemporaryTopic(); JmsPoolTopicPublisher publisher = (JmsPoolTopicPublisher) session.createPublisher(topic); assertNotNull(publisher.getTopicPublisher()); assertTrue(publisher.getTopicPublisher() instanceof MockJMSTopicPublisher); publisher.close(); try { publisher.getTopicPublisher(); fail("Cannot read state on closed publisher"); } catch (IllegalStateException ise) {} }