### Question:
HeatStackAudit { protected Optional<String> extractStackPathFromHref(String href) { try { URI uri = new URI(href); Pattern p = Pattern.compile("/stacks.*"); Matcher m = p.matcher(uri.getPath()); if (m.find()) { return Optional.of(m.group()); } else return Optional.empty(); } catch (Exception e) { logger.error("Error parsing URI", e); } return Optional.empty(); }  Optional<AAIObjectAuditList> queryHeatStack(String cloudOwner, String cloudRegion, String tenantId,
            String heatStackName); Optional<AAIObjectAuditList> auditHeatStack(String cloudRegion, String cloudOwner, String tenantId,
            String heatStackName);  }### Answer:
@Test public void extract_proper_path_Test() { Optional<String> actualResult = extractStackPathFromHref( "https: assertEquals("/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81", actualResult.get()); }
@Test public void extract_invalid_uri_Test() { Optional<String> actualResult = extractStackPathFromHref( "orchestrn.com:8004/v18b44d60a6f94bdcb2738f9e assertEquals(false, actualResult.isPresent()); }