1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -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.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 {