November 2018
Intermediate to advanced
388 pages
9h 5m
English
Let's write test cases to check the publishMessage() and listenToMessage() functions.
We can write a PublisherTest as follows:
class PublisherTest { @Test fun testPublishMessage() { val seContainerInitializer = SeContainerInitializer.newInstance() val seContainer = seContainerInitializer.initialize() val publisherInstance = seContainer.select(Publisher::class.java) val publisher = publisherInstance.get() Assert.assertNotNull(publisher) val message = "Test messgage for topic111" publisher.publishMessage(message) }}
We initialize the container to inject the dependencies. We get an instance of Publisher and invoke the publishMessage() function by passing the message. This message will be published ...
Read now
Unlock full access