MessageConsumer messageConsumer = mock(MessageConsumer.class);
when(mockXASession.createConsumer((Destination) anyObject())).thenReturn(messageConsumer);
when(mockXASession.createConsumer((Destination) anyObject(), anyString())).thenReturn(messageConsumer);
when(mockXASession.createConsumer((Destination) anyObject(), anyString(), anyBoolean())).thenReturn(messageConsumer);
Queue queue = mock(Queue.class);
when(mockXASession.createQueue(anyString())).thenReturn(queue);
Topic topic = mock(Topic.class);
when(mockXASession.createTopic(anyString())).thenReturn(topic);
MockXAResource mockXAResource = new MockXAResource(null);
when(mockXASession.getXAResource()).thenReturn(mockXAResource);
Answer<Session> sessionAnswer = new Answer<Session>() {