### Question:
SqsQueueResource { public void setPolicy(final Policy policy) throws AmazonClientException { final Map<String, String> queueAttributes = Collections.singletonMap(AWS_POLICY_ATTRIBUTE, policy.toJson()); amazonSqsClient.setQueueAttributes(new SetQueueAttributesRequest(queueUrl, queueAttributes)); } SqsQueueResource(final String queueName, final String queueUrl, final AmazonSQS amazonSqsClient); void sendMessage(final String messageBody); void sendDelayedMessage(final String messageBody, final int delaySeconds); List<Message> receiveMessages(); List<Message> receiveMessages(final int waitTimeSeconds, final int maxMessages); void deleteMessage(final String receiptHandle); void setPolicy(final Policy policy); String queueArn(); String getQueueName();  }### Answer:
@Test public void shouldSetQueueAttributes_withPolicy() { final Policy mockPolicy = mock(Policy.class); final String mockPolicyJson = randomString(); when(mockPolicy.toJson()).thenReturn(mockPolicyJson); sqsQueueResource.setPolicy(mockPolicy); final ArgumentCaptor<SetQueueAttributesRequest> captor = ArgumentCaptor .forClass(SetQueueAttributesRequest.class); verify(amazonSqsClient).setQueueAttributes(captor.capture()); final SetQueueAttributesRequest setQueueAttributesRequest = captor.getValue(); assertEquals(queueUrl, setQueueAttributesRequest.getQueueUrl()); assertEquals(mockPolicyJson, setQueueAttributesRequest.getAttributes() .get(QueueAttributeName.Policy.toString())); }