### Question:
SSOUtils { public static Optional<String> generateConsumerURL(String contextPath, String acsBase, String acsPostfix) { if ((contextPath != null) && (acsBase != null) && (acsPostfix != null)) { return Optional.of(acsBase + contextPath + "/" + acsPostfix); } 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 consumer URL generated from a valid context path") public void testGeneratingConsumerURL() { String expected = TestConstants.DEFAULT_APPLICATION_SERVER_URL + "/" + TestConstants.FOO_CONTEXT + "/" + TestConstants.DEFAULT_CONSUMER_URL_POSTFIX; Optional<String> actual = SSOUtils.generateConsumerURL("/" + TestConstants.FOO_CONTEXT, TestConstants. DEFAULT_APPLICATION_SERVER_URL, Constants.DEFAULT_CONSUMER_URL_POSTFIX); Assert.assertTrue((actual.isPresent()) && (actual.get().equals(expected))); }
@Test(description = "Tests the validity of the consumer URL generated from an invalid context path") public void testGeneratingConsumerURLFromInvalidContextPath() { WebAppSingleSignOn ssoConfiguration = new WebAppSingleSignOn(); ssoConfiguration.setConsumerURLPostfix(Constants.DEFAULT_CONSUMER_URL_POSTFIX); Optional<String> actual = SSOUtils.generateConsumerURL(null, TestConstants. DEFAULT_APPLICATION_SERVER_URL, Constants.DEFAULT_CONSUMER_URL_POSTFIX); Assert.assertTrue(!actual.isPresent()); }