Skip to content

Commit

Permalink
Add test to make sure hasCapability() opens a connection if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
cketti committed Jan 9, 2019
1 parent 2a4f1c4 commit e4d7482
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,19 @@ public void executeSingleCommand_withNoResponse_shouldThrowNegativeImapResponseE
server.verifyInteractionCompleted();
}

@Test
public void hasCapability_withNotYetOpenedConnection_shouldConnectAndFetchCapabilities() throws Exception {
MockImapServer server = new MockImapServer();
simpleOpenDialog(server, "X-SOMETHING");
ImapConnection imapConnection = startServerAndCreateImapConnection(server);

boolean capabilityPresent = imapConnection.hasCapability("X-SOMETHING");

assertTrue(capabilityPresent);
server.verifyConnectionStillOpen();
server.verifyInteractionCompleted();
}

private ImapConnection createImapConnection(ImapSettings settings, TrustedSocketFactory socketFactory,
ConnectivityManager connectivityManager, OAuth2TokenProvider oAuth2TokenProvider) {
return new ImapConnection(settings, socketFactory, connectivityManager, oAuth2TokenProvider,
Expand Down

0 comments on commit e4d7482

Please sign in to comment.