/*
 * Copyright 2013, Red Hat, Inc. and individual contributors as indicated by the
 * @author tags. See the copyright.txt file in the distribution for a full
 * listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it under the
 * terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This software is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this software; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
 * site: http://www.fsf.org.
 */
package org.zanata.feature.administration;

import org.concordion.api.extension.Extensions;
import org.concordion.ext.ScreenshotExtension;
import org.concordion.ext.TimestampFormatterExtension;
import org.concordion.integration.junit4.ConcordionRunner;
import org.junit.Before;
import org.junit.Rule;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.zanata.concordion.CustomResourceExtension;
import org.zanata.feature.ConcordionTest;
import org.zanata.page.administration.ManageUserAccountPage;
import org.zanata.page.administration.ManageUserPage;
import org.zanata.page.utility.DashboardPage;
import org.zanata.util.AddUsersRule;
import org.zanata.workflow.LoginWorkFlow;

@RunWith(ConcordionRunner.class)
@Extensions({ ScreenshotExtension.class, TimestampFormatterExtension.class,
        CustomResourceExtension.class })
@Category(ConcordionTest.class)
public class ManageUsersTest {
    @Rule
    public AddUsersRule addUsersRule = new AddUsersRule();

    private DashboardPage dashboardPage;

    @Before
    public void before() {
        dashboardPage = new LoginWorkFlow().signIn("admin", "admin");
    }

    public ManageUserPage goToUserAdministration() {
        return dashboardPage.goToAdministration().goToManageUserPage();
    }

    public ManageUserAccountPage editUserAccount(ManageUserPage manageUserPage,
            String username) {
        return manageUserPage.editUserAccount(username);
    }

    public ManageUserPage changeUsernameAndPassword(
            ManageUserAccountPage manageUserAccount, String username,
            String password) {
        return manageUserAccount.clearFields().enterUsername(username)
                .enterPassword(password).enterConfirmPassword(password)
                .saveUser();
    }

    public boolean userListContains(ManageUserPage manageUserPage,
            String username) {
        return manageUserPage.getUserList().contains(username);
    }

}

@@ -1249,16 +1249,44 @@
 Before;%0A
+import org.junit.ClassRule;%0A
 import o
@@ -1674,24 +1674,61 @@
 dUsersRule;%0A
+import org.zanata.util.HasEmailRule;%0A
 import org.z
@@ -1971,16 +1971,98 @@
 sTest %7B%0A
+    @ClassRule%0A    public static HasEmailRule hasEmailRule = new HasEmailRule();%0A%0A
     @Rul

fix test after email infra change