### Question:
Stack { public String physicalResourceId(final String logicalResourceId) { return describeResource(logicalResourceId).getPhysicalResourceId(); } Stack(final AmazonCloudFormation cloudFormationClient, final String name); StackResourceDetail describeResource(final String logicalResourceId); String physicalResourceId(final String logicalResourceId); com.amazonaws.services.cloudformation.model.Stack describe();  }### Answer:
@Test public void shouldReturnPhysicalResourceId_withLogicalResourceId() { final String logicalResourceId = randomString(); final String physicalResourceId = randomString(); final StackResourceDetail stackResourceDetail = new StackResourceDetail() .withPhysicalResourceId(physicalResourceId); final DescribeStackResourceResult describeStackResourceResult = new DescribeStackResourceResult() .withStackResourceDetail(stackResourceDetail); final DescribeStackResourceRequest expectedRequest = new DescribeStackResourceRequest() .withLogicalResourceId(logicalResourceId).withStackName(stackName); when(mockCloudFormationClient.describeStackResource(expectedRequest)).thenReturn(describeStackResourceResult); final String result = stack.physicalResourceId(logicalResourceId); assertSame(physicalResourceId, result); }