### Question:
SnsTopicResource { public void publish(final String subject, final String message) throws AmazonClientException { final Map<String, MessageAttributeValue> attributes = new HashMap<String, MessageAttributeValue>(); attributes.put("subject", new MessageAttributeValue().withDataType("String").withStringValue(subject)); final PublishRequest request = new PublishRequest().withTopicArn(topicArn).withSubject(subject) .withMessage(message).withMessageAttributes(attributes); amazonSnsClient.publish(request); } 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_onAmazonClientExceptionFromPublish() { final String subject = randomString(); final String message = randomString(); when(mockAmazonSnsClient.publish(any(PublishRequest.class))).thenThrow(AmazonClientException.class); AmazonClientException thrownException = null; try { snsTopicResource.publish(subject, message); } catch (final AmazonClientException e) { thrownException = e; } assertNotNull(thrownException); }