### Question:
SSOUtils { public static Optional<String> generateIssuerID(String contextPath, String hostAppBase) { if (contextPath != null) { String issuerId = contextPath.replaceFirst("/" + hostAppBase, "").replace("/", "_"); if (issuerId.startsWith("_")) { issuerId = issuerId.substring(1); } return Optional.of(issuerId); } else { return Optional.empty(); } } private  SSOUtils(); static String createID(); static Optional<String> constructApplicationServerURL(Request request); static Map<String, String[]> getSplitQueryParameters(String queryParameterString); @SuppressWarnings("unchecked") static Map<String, Object> generateRelayState(Request request); static Optional<String> generateIssuerID(String contextPath, String hostAppBase); static Optional<String> generateConsumerURL(String contextPath, String acsBase, String acsPostfix); static Optional generateKeyStore(); static void sendCharacterData(HttpServletResponse response, String htmlPayload); static void doBootstrap(); static RequestAbstractType setSignature(RequestAbstractType request, String signatureAlgorithm,
                                                   X509Credential credential); static String encodeRequestMessage(RequestAbstractType requestMessage, String binding); static String marshall(XMLObject xmlObject); static Optional<XMLObject> unmarshall(String xmlString); static Assertion decryptAssertion(SSOX509Credential ssoAgentX509Credential,
                                             EncryptedAssertion encryptedAssertion); static Map<String, List<String>> getAssertionStatements(Assertion assertion); static void addDeflateSignatureToHTTPQueryString(StringBuilder httpQueryString, X509Credential credential);  }### Answer:
@Test(description = "Tests the validity of the issuer ID generated from a valid context path") public void testGeneratingIssuerID() { String contextPath = "/" + TestConstants.WEB_APP_BASE + "/" + TestConstants.FOO_CONTEXT; Optional<String> actualIssuerID = SSOUtils.generateIssuerID(contextPath, TestConstants.WEB_APP_BASE); Assert.assertTrue((actualIssuerID.isPresent()) && (actualIssuerID.get().equals(("/" + TestConstants.FOO_CONTEXT).substring(1)))); }
@Test(description = "Tests the validity of the issuer ID generated from an invalid context path") public void testGeneratingIssuerIDFromInvalidContextPath() { Optional<String> actualIssuerID = SSOUtils.generateIssuerID(null, TestConstants.WEB_APP_BASE); Assert.assertTrue(!actualIssuerID.isPresent()); }