Peter Peter - 1 year ago 75
Java Question

Asserting I have received 10 messages

I'm trying to assert the fact I have received 10 messages from pubnub. I do infact receive them to the console. However what would be the right way to assert that I have. I'm not entirely sure on what syntax I should use.

public void testPublisher() throws PubnubException {

// Send 10 messages
for(int i = 0; i <= 10; i++){
service.publish("my_channel", "Message: " + i);

// Wait until we have recieved the 10 messages
do{}while(service.count() <= 10);

// For each message print out the details


Answer Source

You should be able to use
assertTrue(service.count() == 10);

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download