1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Test connection w/o server

This commit is contained in:
Jan Berkel 2015-01-13 10:09:42 +01:00
parent e98f323222
commit bdbe976396

View File

@ -10,6 +10,7 @@ import com.fsck.k9.endtoend.framework.UserForImap;
import com.fsck.k9.mail.AuthType; import com.fsck.k9.mail.AuthType;
import com.fsck.k9.mail.AuthenticationFailedException; import com.fsck.k9.mail.AuthenticationFailedException;
import com.fsck.k9.mail.ConnectionSecurity; import com.fsck.k9.mail.ConnectionSecurity;
import com.fsck.k9.mail.MessagingException;
import junit.framework.TestCase; import junit.framework.TestCase;
import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertArrayEquals;
@ -36,6 +37,16 @@ public class ImapConnectionTest extends TestCase {
stubMailServer.stop(); 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 { public void testOpenConnectionWithWrongCredentialsThrowsAuthenticationFailedException() throws Exception {
connection = new ImapConnection(new TestImapSettings("wrong", "password"), null, null); connection = new ImapConnection(new TestImapSettings("wrong", "password"), null, null);
try { try {