Test connection w/o server

This commit is contained in:
Jan Berkel 2015-01-13 10:09:42 +01:00
parent e98f323222
commit bdbe976396
1 changed files with 11 additions and 0 deletions

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 {