### Question:
SnsTopicResource { public void setPolicy(final Policy policy) throws AmazonClientException { amazonSnsClient .setTopicAttributes(new SetTopicAttributesRequest(topicArn, TOPIC_POLICY_ATTRIBUTE, policy.toJson())); } 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_onAmazonClientExceptionFromSetPolicy() { final Policy mockPolicy = mock(Policy.class); final String mockPolicyJson = randomString(); when(mockPolicy.toJson()).thenReturn(mockPolicyJson); doThrow(AmazonClientException.class).when(mockAmazonSnsClient) .setTopicAttributes(any(SetTopicAttributesRequest.class)); AmazonClientException thrownException = null; try { snsTopicResource.setPolicy(mockPolicy); } catch (final AmazonClientException e) { thrownException = e; } assertNotNull(thrownException); }