### Question:
ConfigureSocialAuthN extends Task { String getValidatedClientSecret(Map<String, ?> params) throws WorkflowException { String clientSecret = getNonEmptyString(params, P_CLIENT_SECRET, "missing-clientSecret"); String clientSecretConfirm = getNonEmptyString(params, P_CLIENT_SECRET_CONFIRM, "missing-clientSecretConfirm"); if (!clientSecret.equals(clientSecretConfirm)) { throw new WorkflowException("secrets-doesnt-match", null); } return clientSecret; }  @Override String execute(Locale locale, Map params);  }### Answer:
@Test public void testGetValidatedClientSecret() throws Exception { Map<String, Set<String>> params = new HashMap<String, Set<String>>(); params.put(P_CLIENT_SECRET, asSet("fred")); params.put(P_CLIENT_SECRET_CONFIRM, asSet("fred")); assertEquals(task.getValidatedClientSecret(params), "fred"); }
@Test public void testGetValidatedClientSecretMissingSecret() throws Exception { Map<String, Set<String>> params = new HashMap<String, Set<String>>(); params.put(P_CLIENT_SECRET_CONFIRM, asSet("freddy")); try { task.getValidatedClientSecret(params); fail("Expect exception"); } catch (WorkflowException e) { assertEquals(e.getErrorCode(), "missing-clientSecret"); } }
@Test public void testGetValidatedClientSecretMissingSecretConfirm() throws Exception { Map<String, Set<String>> params = new HashMap<String, Set<String>>(); params.put(P_CLIENT_SECRET, asSet("freddy")); try { task.getValidatedClientSecret(params); fail("Expect exception"); } catch (WorkflowException e) { assertEquals(e.getErrorCode(), "missing-clientSecretConfirm"); } }
@Test public void testGetValidatedClientSecretMismatch() throws Exception { Map<String, Set<String>> params = new HashMap<String, Set<String>>(); params.put(P_CLIENT_SECRET, asSet("fred")); params.put(P_CLIENT_SECRET_CONFIRM, asSet("freddy")); try { task.getValidatedClientSecret(params); fail("Expect exception"); } catch (WorkflowException e) { assertEquals(e.getErrorCode(), "secrets-doesnt-match"); } }