Skip to content

Instantly share code, notes, and snippets.

@bgswan
Created August 21, 2012 19:42
Show Gist options
  • Save bgswan/3418656 to your computer and use it in GitHub Desktop.
Save bgswan/3418656 to your computer and use it in GitHub Desktop.
Pathalogical Mock Example
JMSMockObjectFactory objectFactory = new JMSMockObjectFactory();
JMSTestModule testModule = new JMSTestModule(objectFactory);
TopicConnectionFactory beTopicConnectionFactory = objectFactory.createMockTopicConnectionFactory();
Topic beTopic = objectFactory.getDestinationManager().createTopic("sampleTopic");
//Perform you test - Publish the message
//Create the expected Message by the subscriber
MockMessage mockmessage = new MockMessage();
//set properties to mockmessage
//condition - similar to assertequals
testModule.verifyReceivedTopicMessageEquals("sampleTopic", 1, mockmessage);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment