// Path: pooled-jms/src/test/java/org/messaginghub/pooled/jms/mock/MockJMSTopicSubscriber.java
// public class MockJMSTopicSubscriber extends MockJMSMessageConsumer implements TopicSubscriber {
// 
//     public MockJMSTopicSubscriber(MockJMSSession session, String consumerId, MockJMSDestination destination, String messageSelector, boolean noLocal) throws JMSException {
//         super(session, consumerId, destination, messageSelector, noLocal);
//     }
// 
//     @Override
//     public Topic getTopic() throws IllegalStateException {
//         checkClosed();
//         return (Topic) this.destination;
//     }
// 
//     @Override
//     public boolean getNoLocal() throws JMSException {
//         checkClosed();
//         return noLocal;
//     }
// }


import org.messaginghub.pooled.jms.mock.MockJMSTopicSubscriber;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import javax.jms.IllegalStateException;
import javax.jms.JMSException;
import javax.jms.Session;
import javax.jms.Topic;
import javax.jms.TopicSession;
import javax.jms.TopicSubscriber;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
    public void testGetNoLocal() throws JMSException {
        JmsPoolConnection connection = (JmsPoolConnection) cf.createTopicConnection();
        TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
        Topic topic = session.createTemporaryTopic();
        TopicSubscriber subscriber = session.createDurableSubscriber(topic, "name", "color = red", true);

        assertTrue(subscriber.getNoLocal());

        subscriber.close();

        try {
            subscriber.getNoLocal();
            fail("Cannot read state on closed subscriber");
        } catch (IllegalStateException ise) {}
    }

    @Test
    public void testGetTopicSubscriber() throws JMSException {
        JmsPoolConnection connection = (JmsPoolConnection) cf.createTopicConnection();
        TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
        Topic topic = session.createTemporaryTopic();
        JmsPoolTopicSubscriber subscriber = (JmsPoolTopicSubscriber) session.createDurableSubscriber(topic, "name", "color = red", true);

        assertNotNull(subscriber.getTopicSubscriber());
        assertTrue(subscriber.getTopicSubscriber() instanceof MockJMSTopicSubscriber);

        subscriber.close();

        try {
            subscriber.getTopicSubscriber();
// Path: pooled-jms/src/test/java/org/messaginghub/pooled/jms/mock/MockJMSTopicSubscriber.java
// public class MockJMSTopicSubscriber extends MockJMSMessageConsumer implements TopicSubscriber {
// 
//     public MockJMSTopicSubscriber(MockJMSSession session, String consumerId, MockJMSDestination destination, String messageSelector, boolean noLocal) throws JMSException {
//         super(session, consumerId, destination, messageSelector, noLocal);
//     }
// 
//     @Override
//     public Topic getTopic() throws IllegalStateException {
//         checkClosed();
//         return (Topic) this.destination;
//     }
// 
//     @Override
//     public boolean getNoLocal() throws JMSException {
//         checkClosed();
//         return noLocal;
//     }
// }


// Path: pooled-jms/src/test/java/org/messaginghub/pooled/jms/JmsPoolTopicSubscriberTest.java
import org.messaginghub.pooled.jms.mock.MockJMSTopicSubscriber;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import javax.jms.IllegalStateException;
import javax.jms.JMSException;
import javax.jms.Session;
import javax.jms.Topic;
import javax.jms.TopicSession;
import javax.jms.TopicSubscriber;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;

    public void testGetNoLocal() throws JMSException {
        JmsPoolConnection connection = (JmsPoolConnection) cf.createTopicConnection();
        TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
        Topic topic = session.createTemporaryTopic();
        TopicSubscriber subscriber = session.createDurableSubscriber(topic, "name", "color = red", true);

        assertTrue(subscriber.getNoLocal());

        subscriber.close();

        try {
            subscriber.getNoLocal();
            fail("Cannot read state on closed subscriber");
        } catch (IllegalStateException ise) {}
    }

    @Test
    public void testGetTopicSubscriber() throws JMSException {
        JmsPoolConnection connection = (JmsPoolConnection) cf.createTopicConnection();
        TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
        Topic topic = session.createTemporaryTopic();
        JmsPoolTopicSubscriber subscriber = (JmsPoolTopicSubscriber) session.createDurableSubscriber(topic, "name", "color = red", true);

        assertNotNull(subscriber.getTopicSubscriber());
        assertTrue(subscriber.getTopicSubscriber() instanceof MockJMSTopicSubscriber);

        subscriber.close();

        try {
            subscriber.getTopicSubscriber();
            fail("Cannot read state on closed subscriber");