@Test public void testCreateListDeleteTopic_shouldCreateReturnAndDelete() { mockSns(new MockParameters()); ListTopicsResult listTopicResultBefore = sns.listTopics(); assertEquals("topic list should contain zero items before insert",0,listTopicResultBefore.getTopics().size()); CreateTopicRequest create = new CreateTopicRequest() .withName("major-topic"); CreateTopicResult createResult = sns.createTopic(create); String topicArn = createResult.getTopicArn(); assertNotNull("verify returned topic ARN", topicArn); ListTopicsResult listTopicResult = sns.listTopics(); assertEquals("after insert topic list should contain 1 item",1,listTopicResult.getTopics().size()); assertEquals("after insert topic list should contain before inserted topic arn", topicArn, listTopicResult.getTopics().get(0).getTopicArn()); DeleteTopicResult deleteResult = sns.deleteTopic(topicArn); assertNotNull(deleteResult); ListTopicsResult listTopicsAfterDeletion = sns.listTopics(); assertEquals("topic list should contain zero items after deletion",0,listTopicsAfterDeletion.getTopics().size()); }
@Override public DeleteTopicResult deleteTopic(DeleteTopicRequest deleteTopicRequest) throws AmazonClientException { List<String> subscriptions = Objects.firstNonNull( _subscriptionsForTopic.remove(deleteTopicRequest.getTopicArn()), new ArrayList<String>()); for (String subscription : subscriptions) { _subscriptionsByArn.remove(subscription); } return new DeleteTopicResult(); }
private DeleteTopicResult deleteTopic(String arn) { return snsClient.deleteTopic(arn); }
@Override public DeleteTopicResult deleteTopic(DeleteTopicRequest deleteTopicRequest) throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException(); }