### Question:
ClientHelper { public CloudTarget computeTarget(String spaceId) { CloudSpace space = attemptToFindSpace(spaceId); if (space != null) { return new CloudTarget(space.getOrganization() .getName(), space.getName()); } return null; } ClientHelper(CloudControllerClient client); void deleteRoute(String uri); String computeSpaceId(String orgName, String spaceName); CloudTarget computeTarget(String spaceId);  }### Answer:
@Test void testComputeTarget() { Mockito.when(client.getSpace(Matchers.any(UUID.class))) .thenReturn(createCloudSpace(GUID, SPACE_NAME, ORG_NAME)); CloudTarget target = clientHelper.computeTarget(SPACE_ID); Assertions.assertEquals(ORG_NAME, target.getOrganizationName()); Assertions.assertEquals(SPACE_NAME, target.getSpaceName()); }
@Test void testComputeTargetCloudOperationExceptionForbiddenThrown() { Mockito.when(client.getSpace(Matchers.any(UUID.class))) .thenThrow(new CloudOperationException(HttpStatus.FORBIDDEN)); Assertions.assertNull(clientHelper.computeTarget(SPACE_ID)); }
@Test void testComputeTargetCloudOperationExceptionNotFoundThrown() { Mockito.when(client.getSpace(Matchers.any(UUID.class))) .thenThrow(new CloudOperationException(HttpStatus.NOT_FOUND)); Assertions.assertNull(clientHelper.computeTarget(SPACE_ID)); }
@Test void testComputeTargetCloudOperationExceptionBadRequestThrown() { Mockito.when(client.getSpace(Matchers.any(UUID.class))) .thenThrow(new CloudOperationException(HttpStatus.BAD_REQUEST)); CloudOperationException cloudOperationException = Assertions.assertThrows(CloudOperationException.class, () -> clientHelper.computeTarget(SPACE_ID)); Assertions.assertEquals(HttpStatus.BAD_REQUEST, cloudOperationException.getStatusCode()); }