diff --git a/k9mail/src/androidTest/java/com/fsck/k9/mail/store/imap/ImapConnectionTest.java b/k9mail/src/androidTest/java/com/fsck/k9/mail/store/imap/ImapConnectionTest.java index b10705e06..8355ebff2 100644 --- a/k9mail/src/androidTest/java/com/fsck/k9/mail/store/imap/ImapConnectionTest.java +++ b/k9mail/src/androidTest/java/com/fsck/k9/mail/store/imap/ImapConnectionTest.java @@ -10,6 +10,7 @@ import com.fsck.k9.endtoend.framework.UserForImap; import com.fsck.k9.mail.AuthType; import com.fsck.k9.mail.AuthenticationFailedException; import com.fsck.k9.mail.ConnectionSecurity; +import com.fsck.k9.mail.MessagingException; import junit.framework.TestCase; import static org.junit.Assert.assertArrayEquals; @@ -36,6 +37,16 @@ public class ImapConnectionTest extends TestCase { stubMailServer.stop(); } + public void testOpenConnectionWithoutRunningServerThrowsMessagingException() throws Exception { + stubMailServer.stop(); + try { + connection.open(); + fail("expected exception"); + } catch (MessagingException e) { + assertFalse(connection.isOpen()); + } + } + public void testOpenConnectionWithWrongCredentialsThrowsAuthenticationFailedException() throws Exception { connection = new ImapConnection(new TestImapSettings("wrong", "password"), null, null); try {