### Question:
ConfigureSocialAuthN extends Task { Map<String, Set<String>> collectAuthModuleAttributes(Locale locale, String type, Map<String, Set<String>> params) throws WorkflowException { Map<String, Set<String>> attrs = new CaseInsensitiveHashMap(); attrs.putAll(readPropertiesFile(type)); String clientId = getNonEmptyString(params, P_CLIENT_ID, "missing-clientId"); String clientSecret = getValidatedClientSecret(params); String redirectUrl = getValidatedRedirectUrl(params); attrs.put(AUTH_MODULE_CLIENT_ID, asSet(clientId)); attrs.put(AUTH_MODULE_CLIENT_SECRET, asSet(clientSecret)); attrs.put(AUTH_MODULE_PROXY_URL, asSet(redirectUrl)); attrs.put(AUTH_MODULE_CRYPTO_TYPE, asSet("client_secret")); attrs.put(AUTH_MODULE_CREATE_PASSWORD, asSet("false")); String discoveryUrl = getString(params, P_OPENID_DISCOVERY_URL); if (discoveryUrl == null) { discoveryUrl = CollectionHelper.getMapAttr(attrs, P_OPENID_DISCOVERY_URL); } if (discoveryUrl != null) { attrs.putAll(readOpenIDWellKnownConfig(locale, discoveryUrl)); } return attrs; }  @Override String execute(Locale locale, Map params);  }### Answer:
@Test public void testCollectAuthModuleAttributes() throws Exception { Map<String, Set<String>> params = new HashMap<String, Set<String>>(); params.put(P_CLIENT_ID, asSet("fred")); params.put(P_CLIENT_SECRET, asSet("freddy")); params.put(P_CLIENT_SECRET_CONFIRM, asSet("freddy")); params.put(P_REDIRECT_URL, asSet("http: Map<String, Set<String>> attrs = task.collectAuthModuleAttributes(Locale.ENGLISH, "microsoft", params); assertEquals(getMapAttr(attrs, "providerName"), "Microsoft"); assertEquals(getMapAttr(attrs, AUTH_MODULE_CLIENT_ID), "fred"); assertEquals(getMapAttr(attrs, AUTH_MODULE_CLIENT_SECRET), "freddy"); assertEquals(getMapAttr(attrs, AUTH_MODULE_CRYPTO_TYPE), "client_secret"); assertEquals(getMapAttr(attrs, AUTH_MODULE_CRYPTO_VALUE), "freddy"); assertEquals(getMapAttr(attrs, AUTH_MODULE_PROXY_URL), "http: }
@Test public void testCollectAuthModuleAttributesMissingClientId() throws Exception { Map<String, Set<String>> params = new HashMap<String, Set<String>>(); try { task.collectAuthModuleAttributes(Locale.ENGLISH, "other", params); fail("Expect exception"); } catch (WorkflowException e) { assertEquals(e.getErrorCode(), "missing-clientId"); } }