### Question:
ConfigureSocialAuthN extends Task { String getValidatedRedirectUrl(Map<String, ?> params) throws WorkflowException { String redirectUrl = getNonEmptyString(params, P_REDIRECT_URL, "missing-redirectUrl"); try { URL url = new URL(redirectUrl); } catch (MalformedURLException murle) { throw new WorkflowException("invalid-redirectUrl", null); } return redirectUrl; }  @Override String execute(Locale locale, Map params);  }### Answer:
@Test public void testGetValidatedRedirectUrl() throws Exception { Map<String, Set<String>> params = new HashMap<String, Set<String>>(); params.put(P_REDIRECT_URL, asSet("http: assertEquals(task.getValidatedRedirectUrl(params), "http: }
@Test public void testGetValidatedRedirectUrlMissing() throws Exception { Map<String, Set<String>> params = new HashMap<String, Set<String>>(); try { task.getValidatedRedirectUrl(params); fail("Expect exception"); } catch (WorkflowException e) { assertEquals(e.getErrorCode(), "missing-redirectUrl"); } }
@Test public void testGetValidatedRedirectUrlInvalid() throws Exception { Map<String, Set<String>> params = new HashMap<String, Set<String>>(); params.put(P_REDIRECT_URL, asSet("fred")); try { task.getValidatedRedirectUrl(params); fail("Expect exception"); } catch (WorkflowException e) { assertEquals(e.getErrorCode(), "invalid-redirectUrl"); } }