### Question:
DefaultSqsQueueResourceFactory implements SqsQueueResourceFactory { @Override public SqsQueueResource createSqsQueueResource(final String name) { final String queueUrl = amazonSqsClient.getQueueUrl(new GetQueueUrlRequest(name)).getQueueUrl(); logger.info("Using existing SQS queue: " + name); final SqsQueueResource sqsQueueResource = new SqsQueueResource(name, queueUrl, amazonSqsClient); return sqsQueueResource; } @Autowired  DefaultSqsQueueResourceFactory(final AmazonSQS amazonSqsClient); @Override SqsQueueResource createSqsQueueResource(final String name);  }### Answer:
@Test public void shouldCreateSqsQueueResource_withName() throws Exception { final String name = randomString(); final String queueUrl = randomString(); final GetQueueUrlResult getQueueUrlResult = new GetQueueUrlResult().withQueueUrl(queueUrl); final GetQueueUrlRequest expectedGetQueueUrlRequest = new GetQueueUrlRequest(name); when(mockAmazonSqsClient.getQueueUrl(expectedGetQueueUrlRequest)).thenReturn(getQueueUrlResult); final SqsQueueResource mockSqsQueueResource = mock(SqsQueueResource.class); whenNew(SqsQueueResource.class).withArguments(name, queueUrl, mockAmazonSqsClient) .thenReturn(mockSqsQueueResource); final SqsQueueResource result = factory.createSqsQueueResource(name); assertSame(mockSqsQueueResource, result); }