cns1.subscribe(subscribeRequest);
}
logger.info("Listing subscriptions");
ListSubscriptionsByTopicRequest listSubscriptionsByTopicRequest = new ListSubscriptionsByTopicRequest();
listSubscriptionsByTopicRequest.setTopicArn(topicArn);
ListSubscriptionsByTopicResult listSubscriptionsByTopicResult = cns1.listSubscriptionsByTopic(listSubscriptionsByTopicRequest);
assertTrue("First page should contain 100 subscriptions, found instead " + listSubscriptionsByTopicResult.getSubscriptions().size(),listSubscriptionsByTopicResult.getSubscriptions().size() == 100);
listSubscriptionsByTopicRequest = new ListSubscriptionsByTopicRequest();
listSubscriptionsByTopicRequest.setTopicArn(topicArn);
listSubscriptionsByTopicRequest.setNextToken(listSubscriptionsByTopicResult.getNextToken());
listSubscriptionsByTopicResult = cns1.listSubscriptionsByTopic(listSubscriptionsByTopicRequest);
assertTrue("Second page should contain 10 subscriptions, found instead " + listSubscriptionsByTopicResult.getSubscriptions().size(), listSubscriptionsByTopicResult.getSubscriptions().size() == 10);