1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

Setup and tear down server between tests

This commit is contained in:
Jan Berkel 2015-01-13 01:04:49 +01:00
parent 7958467503
commit 111212b391
2 changed files with 10 additions and 9 deletions

View File

@ -37,6 +37,12 @@ public abstract class AbstractEndToEndTest<T extends Activity> extends ActivityI
if (bypassWelcome) {
bypassWelcomeScreen();
}
state.stubMailServer = new StubMailServer();
}
@Override
public void tearDown() throws Exception {
state.stubMailServer.stop();
}
private void bypassWelcomeScreen() {
@ -51,10 +57,7 @@ public abstract class AbstractEndToEndTest<T extends Activity> extends ActivityI
}
}
protected StubMailServer setupMailServer() {
if (null == state.stubMailServer) {
state.stubMailServer = new StubMailServer();
}
public StubMailServer stubMailServer() {
return state.stubMailServer;
}
}

View File

@ -45,11 +45,9 @@ public class AccountSetupFlow {
IncomingServerSettingsPage incoming = accountTypePage.clickImap();
StubMailServer stubMailServer = test.setupMailServer();
OutgoingServerSettingsPage outgoing = setupIncomingServerAndClickNext(incoming, test.stubMailServer());
OutgoingServerSettingsPage outgoing = setupIncomingServerAndClickNext(incoming, stubMailServer);
AccountOptionsPage accountOptionsPage = setupOutgoingServerAndClickNext(outgoing, stubMailServer);
AccountOptionsPage accountOptionsPage = setupOutgoingServerAndClickNext(outgoing, test.stubMailServer());
AccountSetupNamesPage accountSetupNamesPage = accountOptionsPage.clickNext();
@ -61,7 +59,7 @@ public class AccountSetupFlow {
accountsPage.assertAccountExists(accountDescription);
ApplicationState.getInstance().accounts.add(new AccountForTest(ACCOUNT_NAME, accountDescription, stubMailServer));
ApplicationState.getInstance().accounts.add(new AccountForTest(ACCOUNT_NAME, accountDescription, test.stubMailServer()));
return accountsPage;
}