### Question:
SnsTopicResource { public void subscribe(final SqsQueueResource sqsQueueResource) throws AmazonClientException { amazonSnsClient.subscribe(new SubscribeRequest(topicArn, "sqs", sqsQueueResource.queueArn())); } SnsTopicResource(final String topicName, final String topicArn, final AmazonSNS amazonSnsClient); void publish(final String subject, final String message); void subscribe(final SqsQueueResource sqsQueueResource); void setPolicy(final Policy policy); String getTopicName(); String getTopicArn();  }### Answer:
@Test public void shouldThrowException_onAmazonClientExceptionFromSubscribe() { final SqsQueueResource mockSqsQueueResource = mock(SqsQueueResource.class); final String queueArn = randomString(); when(mockSqsQueueResource.queueArn()).thenReturn(queueArn); when(mockAmazonSnsClient.subscribe(any(SubscribeRequest.class))).thenThrow(AmazonClientException.class); AmazonClientException thrownException = null; try { snsTopicResource.subscribe(mockSqsQueueResource); } catch (final AmazonClientException e) { thrownException = e; } assertNotNull(thrownException); }