@Test public void testAddPermission_withSuccessMock_shouldWork() { mockSns(new MockParameters()); AddPermissionRequest addPermissionRequest = new AddPermissionRequest() .withActionNames(ImmutableList.of("READ", "WRITE")) .withAWSAccountIds(ImmutableList.of("1", "2")).withLabel("unsecure-topic").withTopicArn( "arn:aws:sns:us-east-1:123456789012:my_corporate_topic:02034b43-fefa-4e07-a5eb-3be56f8c54ce"); AddPermissionResult result = sns.addPermission(addPermissionRequest); assertNotNull("verify adding permission returns ok", result); }
@Test public void testAddPermissionAsync_shouldWork() throws InterruptedException, ExecutionException { mockSns(new MockParameters()); AddPermissionRequest addPermissionRequest = new AddPermissionRequest() .withActionNames(ImmutableList.of("READ", "WRITE")) .withAWSAccountIds(ImmutableList.of("1", "2")).withLabel("unsecure-topic").withTopicArn( "arn:aws:sns:us-east-1:123456789012:my_corporate_topic:02034b43-fefa-4e07-a5eb-3be56f8c54ce"); Future<AddPermissionResult> result = sns.addPermissionAsync(addPermissionRequest); assertNotNull("verify also async call works fine", result.get()); }
@Test public void testAddPermissionAsync_withNoRequestParams_shouldWork() throws InterruptedException, ExecutionException { mockSns(new MockParameters()); Future<AddPermissionResult> result = sns.addPermissionAsync(new AddPermissionRequest()); assertNotNull(result.get()); }
@Override public AddPermissionResult addPermission(AddPermissionRequest addPermissionRequest) throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException(); }