2014-12-18 05:24:43 -05:00
|
|
|
package com.fsck.k9.mail.store.imap;
|
|
|
|
|
2014-12-18 05:56:02 -05:00
|
|
|
import org.junit.Test;
|
2014-12-18 05:24:43 -05:00
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
2014-12-18 05:56:02 -05:00
|
|
|
import static org.junit.Assert.assertEquals;
|
|
|
|
import static org.junit.Assert.assertFalse;
|
|
|
|
import static org.junit.Assert.assertNull;
|
|
|
|
import static org.junit.Assert.assertTrue;
|
|
|
|
import static org.junit.Assert.fail;
|
|
|
|
|
|
|
|
public class ImapListTest {
|
|
|
|
@Test public void testImapListMethods() throws IOException {
|
2014-12-18 05:24:43 -05:00
|
|
|
ImapList list = new ImapList();
|
|
|
|
list.add("ONE");
|
|
|
|
list.add("TWO");
|
|
|
|
list.add("THREE");
|
|
|
|
|
|
|
|
assertTrue(list.containsKey("ONE"));
|
|
|
|
assertTrue(list.containsKey("TWO"));
|
|
|
|
assertFalse(list.containsKey("THREE"));
|
|
|
|
assertFalse(list.containsKey("nonexistent"));
|
|
|
|
|
|
|
|
assertEquals("TWO", list.getKeyedValue("ONE"));
|
|
|
|
assertEquals("THREE", list.getKeyedValue("TWO"));
|
|
|
|
assertNull(list.getKeyedValue("THREE"));
|
|
|
|
assertNull(list.getKeyedValue("nonexistent"));
|
|
|
|
|
|
|
|
assertEquals(0, list.getKeyIndex("ONE"));
|
|
|
|
assertEquals(1, list.getKeyIndex("TWO"));
|
|
|
|
|
|
|
|
try {
|
|
|
|
list.getKeyIndex("THREE");
|
|
|
|
fail("IllegalArgumentException should have been thrown");
|
|
|
|
} catch (IllegalArgumentException e) { /* do nothing */ }
|
|
|
|
|
|
|
|
try {
|
|
|
|
list.getKeyIndex("nonexistent");
|
|
|
|
fail("IllegalArgumentException should have been thrown");
|
|
|
|
} catch (IllegalArgumentException e) { /* do nothing */ }
|
|
|
|
}
|
|
|
|
}
|