@Test public void containsKey_returnsTrueForKeys() throws IOException { ImapList list = buildSampleList(); assertTrue(list.containsKey("ONE")); assertTrue(list.containsKey("TWO")); assertFalse(list.containsKey("THREE")); assertFalse(list.containsKey("nonexistent")); }
private Object handleFetchResponse(ImapMessage message, ImapList fetchList) throws MessagingException { Object result = null; if (fetchList.containsKey("FLAGS")) { ImapList flags = fetchList.getKeyedList("FLAGS"); if (flags != null) { if (fetchList.containsKey("INTERNALDATE")) { Date internalDate = fetchList.getKeyedDate("INTERNALDATE"); message.setInternalDate(internalDate); if (fetchList.containsKey("RFC822.SIZE")) { int size = fetchList.getKeyedNumber("RFC822.SIZE"); message.setSize(size); if (fetchList.containsKey("BODYSTRUCTURE")) { ImapList bs = fetchList.getKeyedList("BODYSTRUCTURE"); if (bs != null) { if (fetchList.containsKey("BODY")) { int index = fetchList.getKeyIndex("BODY") + 2; int size = fetchList.size();
@Test public void containsKey_returnsFalseForStringThatCantBeKey() throws IOException { ImapList list = buildSampleList(); assertFalse(list.containsKey("THREE")); }
@Test public void containsKey_returnsFalseForStringNotInList() throws IOException { ImapList list = buildSampleList(); assertFalse(list.containsKey("nonexistent")); }