### Question:
ComputeServiceUtils { public static String formatStatus(ComputeMetadataIncludingStatus<?> resource) { if (resource.getBackendStatus() == null) return resource.getStatus().toString(); return String.format("%s[%s]", resource.getStatus(), resource.getBackendStatus()); }  static String formatStatus(ComputeMetadataIncludingStatus<?> resource); static Statement execHttpResponse(HttpRequest request); static Statement execHttpResponse(URI location); static Statement extractTargzIntoDirectory(HttpRequest targz, String directory); static Statement extractTargzIntoDirectory(URI targz, String directory); static Statement extractZipIntoDirectory(HttpRequest zip, String directory); static Statement extractZipIntoDirectory(URI zip, String directory); static double getCores(Hardware input); static double getCoresAndSpeed(Hardware input); static double getSpace(Hardware input); static org.jclouds.compute.domain.OsFamily parseOsFamilyOrUnrecognized(String in); static String createExecutionErrorMessage(Map<?, Exception> executionExceptions); static String createNodeErrorMessage(Map<? extends NodeMetadata, ? extends Throwable> failedNodes); static Iterable<? extends ComputeMetadata> filterByName(Iterable<? extends ComputeMetadata> nodes,
            final String name); static Map<String, String> metadataAndTagsAsValuesOfEmptyString(TemplateOptions options); static NodeMetadataBuilder addMetadataAndParseTagsFromValuesOfEmptyString(NodeMetadataBuilder builder,
            Map<String, String> map); static Map<String, String> metadataAndTagsAsCommaDelimitedValue(TemplateOptions options); static NodeMetadataBuilder addMetadataAndParseTagsFromCommaDelimitedValue(NodeMetadataBuilder builder,
            Map<String, String> map); static String parseVersionOrReturnEmptyString(org.jclouds.compute.domain.OsFamily family, String in,
            Map<OsFamily, Map<String, String>> osVersionMap); static Map<Integer, Integer> getPortRangesFromList(int... ports); static String groupFromMapOrName(Map<String, String> metadataMap, String nodeName, GroupNamingConvention namingConvention); static final Pattern DELIMITED_BY_HYPHEN_ENDING_IN_HYPHEN_HEX; }### Answer:
@SuppressWarnings("unchecked") @Test public void testFormatStatusWithBackendStatus() { ComputeMetadataIncludingStatus<Image.Status> resource = createMock(ComputeMetadataIncludingStatus.class); expect(resource.getStatus()).andReturn(Image.Status.PENDING); expect(resource.getBackendStatus()).andReturn("queued").anyTimes(); replay(resource); assertEquals(formatStatus(resource), "PENDING[queued]"); verify(resource); }
@SuppressWarnings("unchecked") @Test public void testFormatStatusWithoutBackendStatus() { ComputeMetadataIncludingStatus<Image.Status> resource = createMock(ComputeMetadataIncludingStatus.class); expect(resource.getStatus()).andReturn(Image.Status.PENDING); expect(resource.getBackendStatus()).andReturn(null).anyTimes(); replay(resource); assertEquals(formatStatus(resource), "PENDING"); verify(resource); }