### Question:
ConfigureAmbariIdentitiesServerAction extends KerberosServerAction { public void configureJAAS(String principal, String keytabFilePath, ActionLog actionLog) { String jaasConfPath = getJAASConfFilePath(); if (jaasConfPath != null) { File jaasConfigFile = new File(jaasConfPath); try { String jaasConfig = FileUtils.readFileToString(jaasConfigFile, Charset.defaultCharset()); File oldJaasConfigFile = new File(jaasConfPath + ".bak"); FileUtils.writeStringToFile(oldJaasConfigFile, jaasConfig, Charset.defaultCharset()); jaasConfig = jaasConfig.replaceFirst(KEYTAB_PATTERN, "keyTab=\"" + keytabFilePath + "\""); jaasConfig = jaasConfig.replaceFirst(PRINCIPAL_PATTERN, "principal=\"" + principal + "\""); FileUtils.writeStringToFile(jaasConfigFile, jaasConfig, Charset.defaultCharset()); String message = String.format("JAAS config file %s modified successfully for principal %s.", jaasConfigFile.getName(), principal); if (actionLog != null) { actionLog.writeStdOut(message); } } catch (IOException e) { String message = String.format("Failed to configure JAAS file %s for %s - %s", jaasConfigFile, principal, e.getMessage()); if (actionLog != null) { actionLog.writeStdErr(message); } LOG.error(message, e); } } else { String message = String.format("Failed to configure JAAS, config file should be passed to Ambari server as: " + "%s.", KerberosChecker.JAVA_SECURITY_AUTH_LOGIN_CONFIG); if (actionLog != null) { actionLog.writeStdErr(message); } LOG.error(message); } }  @Override CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext); boolean installAmbariServerIdentity(ResolvedKerberosPrincipal principal,
                                             String srcKeytabFilePath,
                                             String destKeytabFilePath,
                                             String ownerName, String ownerAccess,
                                             String groupName, String groupAccess,
                                             ActionLog actionLog); void configureJAAS(String principal, String keytabFilePath, ActionLog actionLog);  }### Answer:
@Test public void configureJAAS() throws Exception { configureJAAS(createNiceMock(ActionLog.class)); }
@Test public void configureJAASWithNullActionLog() throws Exception { configureJAAS(null); }