Peter Peter - 7 months ago 40
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



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