target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void testCommandContinuation() throws Exception { ImapResponseParser parser = createParser("+ Ready for additional command text\r\n"); ImapResponse response = parser.readResponse(); assertEquals(1, response.size()); assertEquals("Ready for additional command text", response.getString(0)); }
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test public void testParseLiteral() throws Exception { ImapResponseParser parser = createParser("* {4}\r\ntest\r\n"); ImapResponse response = parser.readResponse(); assertEquals(1, response.size()); assertEquals("test", response.getString(0)); }
private Object parseLiteral() throws IOException { expect('{'); int size = Integer.parseInt(readStringUntil('}')); expect('\r'); expect('\n'); if (size == 0) { return ""; } if (response.getCallback() != null) { FixedLengthInputStream fixed = new FixedLengthInputStream(inputStream, size); Exception callbackException = n...
ImapResponseParser { private Object parseLiteral() throws IOException { expect('{'); int size = Integer.parseInt(readStringUntil('}')); expect('\r'); expect('\n'); if (size == 0) { return ""; } if (response.getCallback() != null) { FixedLengthInputStream fixed = new FixedLengthInputStream(inputStream, size); Exception ...
ImapResponseParser { private Object parseLiteral() throws IOException { expect('{'); int size = Integer.parseInt(readStringUntil('}')); expect('\r'); expect('\n'); if (size == 0) { return ""; } if (response.getCallback() != null) { FixedLengthInputStream fixed = new FixedLengthInputStream(inputStream, size); Exception ...
ImapResponseParser { private Object parseLiteral() throws IOException { expect('{'); int size = Integer.parseInt(readStringUntil('}')); expect('\r'); expect('\n'); if (size == 0) { return ""; } if (response.getCallback() != null) { FixedLengthInputStream fixed = new FixedLengthInputStream(inputStream, size); Exception ...
ImapResponseParser { private Object parseLiteral() throws IOException { expect('{'); int size = Integer.parseInt(readStringUntil('}')); expect('\r'); expect('\n'); if (size == 0) { return ""; } if (response.getCallback() != null) { FixedLengthInputStream fixed = new FixedLengthInputStream(inputStream, size); Exception ...
@Test public void testParseLiteralWithEmptyString() throws Exception { ImapResponseParser parser = createParser("* {0}\r\n\r\n"); ImapResponse response = parser.readResponse(); assertEquals(1, response.size()); assertEquals("", response.getString(0)); }
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test(expected = IOException.class) public void testParseLiteralToEndOfStream() throws Exception { ImapResponseParser parser = createParser("* {4}\r\nabc"); parser.readResponse(); }
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test public void issue2259Spec() { String text = "text\n" + "---------------------------\n" + "some other text\n" + "===========================\n" + "more text\n" + "-=-=-=-=-=-=-=-=-=-=-=-=-=-\n" + "scissors below\n" + "-- >8 --\n" + "other direction\n" + "-- 8< --\n" + "end"; String result = HtmlConverter.textToHtm...
public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesThisLine = 0; for ...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
@Test public void testParseLiteralWithConsumingCallbackReturningNull() throws Exception { ImapResponseParser parser = createParser("* {4}\r\ntest\r\n"); TestImapResponseCallback callback = TestImapResponseCallback.readBytesAndReturn(4, "cheeseburger"); ImapResponse response = parser.readResponse(callback); assertEquals...
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test public void testParseLiteralWithNonConsumingCallbackReturningNull() throws Exception { ImapResponseParser parser = createParser("* {4}\r\ntest\r\n"); TestImapResponseCallback callback = TestImapResponseCallback.readBytesAndReturn(0, null); ImapResponse response = parser.readResponse(callback); assertEquals(1, res...
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test public void readResponse_withPartlyConsumingCallbackReturningNull_shouldThrow() throws Exception { ImapResponseParser parser = createParser("* {4}\r\ntest\r\n"); TestImapResponseCallback callback = TestImapResponseCallback.readBytesAndReturn(2, null); try { parser.readResponse(callback); fail(); } catch (Assertio...
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test public void readResponse_withPartlyConsumingCallbackThatThrows_shouldReadAllDataAndThrow() throws Exception { ImapResponseParser parser = createParser("* {4}\r\ntest\r\n"); TestImapResponseCallback callback = TestImapResponseCallback.readBytesAndThrow(2); try { parser.readResponse(callback); fail(); } catch (Imap...
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test public void readResponse_withCallbackThatThrowsRepeatedly_shouldConsumeAllInputAndThrowFirstException() throws Exception { ImapResponseParser parser = createParser("* {3}\r\none {3}\r\ntwo\r\n"); TestImapResponseCallback callback = TestImapResponseCallback.readBytesAndThrow(3); try { parser.readResponse(callback)...
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test public void testParseLiteralWithIncompleteConsumingCallbackReturningString() throws Exception { ImapResponseParser parser = createParser("* {4}\r\ntest\r\n"); TestImapResponseCallback callback = TestImapResponseCallback.readBytesAndReturn(2, "ninja"); ImapResponse response = parser.readResponse(callback); assertE...
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test public void testParseLiteralWithThrowingCallback() throws Exception { ImapResponseParser parser = createParser("* {4}\r\ntest\r\n"); ImapResponseCallback callback = TestImapResponseCallback.readBytesAndThrow(0); try { parser.readResponse(callback); fail(); } catch (ImapResponseParserException e) { assertEquals("r...
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test(expected = IOException.class) public void testParseLiteralWithCallbackThrowingIOException() throws Exception { ImapResponseParser parser = createParser("* {4}\r\ntest\r\n"); ImapResponseCallback callback = new ImapResponseCallback() { @Override public Object foundLiteral(ImapResponse response, FixedLengthInputStr...
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test public void testParseQuoted() throws Exception { ImapResponseParser parser = createParser("* \"qu\\\"oted\"\r\n"); ImapResponse response = parser.readResponse(); assertEquals(1, response.size()); assertEquals("qu\"oted", response.getString(0)); }
private String parseQuoted() throws IOException { expect('"'); StringBuilder sb = new StringBuilder(); int ch; boolean escape = false; while ((ch = inputStream.read()) != -1) { if (!escape && ch == '\\') { escape = true; } else if (!escape && ch == '"') { return sb.toString(); } else { sb.append((char) ch); escape = fa...
ImapResponseParser { private String parseQuoted() throws IOException { expect('"'); StringBuilder sb = new StringBuilder(); int ch; boolean escape = false; while ((ch = inputStream.read()) != -1) { if (!escape && ch == '\\') { escape = true; } else if (!escape && ch == '"') { return sb.toString(); } else { sb.append((c...
ImapResponseParser { private String parseQuoted() throws IOException { expect('"'); StringBuilder sb = new StringBuilder(); int ch; boolean escape = false; while ((ch = inputStream.read()) != -1) { if (!escape && ch == '\\') { escape = true; } else if (!escape && ch == '"') { return sb.toString(); } else { sb.append((c...
ImapResponseParser { private String parseQuoted() throws IOException { expect('"'); StringBuilder sb = new StringBuilder(); int ch; boolean escape = false; while ((ch = inputStream.read()) != -1) { if (!escape && ch == '\\') { escape = true; } else if (!escape && ch == '"') { return sb.toString(); } else { sb.append((c...
ImapResponseParser { private String parseQuoted() throws IOException { expect('"'); StringBuilder sb = new StringBuilder(); int ch; boolean escape = false; while ((ch = inputStream.read()) != -1) { if (!escape && ch == '\\') { escape = true; } else if (!escape && ch == '"') { return sb.toString(); } else { sb.append((c...
@Test(expected = IOException.class) public void testParseQuotedToEndOfStream() throws Exception { ImapResponseParser parser = createParser("* \"abc"); parser.readResponse(); }
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test public void dashesContainingSpacesIgnoredAsHR() { String text = "hello\n--- --- --- --- ---\nfoo bar"; String result = HtmlConverter.textToHtml(text); assertEquals("<pre class=\"k9mail\">hello<br />--- --- --- --- ---<br />foo bar</pre>", result); }
public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesThisLine = 0; for ...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
@Test(expected = IOException.class) public void testParseAtomToEndOfStream() throws Exception { ImapResponseParser parser = createParser("* abc"); parser.readResponse(); }
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test(expected = IOException.class) public void testParseUntaggedResponseWithoutSpace() throws Exception { ImapResponseParser parser = createParser("*\r\n"); parser.readResponse(); }
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test public void testListResponseContainingFolderNameWithBrackets() throws Exception { ImapResponseParser parser = createParser("* LIST (\\HasNoChildren) \".\" [FolderName]\r\n"); ImapResponse response = parser.readResponse(); assertEquals(4, response.size()); assertEquals("LIST", response.get(0)); assertEquals(1, res...
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test(expected = IOException.class) public void testListResponseContainingFolderNameContainingBracketsThrowsException() throws Exception { ImapResponseParser parser = createParser( "* LIST (\\NoInferiors) \"/\" Root/Folder/Subfolder()\r\n"); parser.readResponse(); }
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test public void readResponseShouldReadWholeListResponseLine() throws Exception { ImapResponseParser parser = createParser("* LIST (\\HasNoChildren) \".\" [FolderName]\r\n" + "TAG OK [List complete]\r\n"); parser.readResponse(); ImapResponse responseTwo = parser.readResponse(); assertEquals("TAG", responseTwo.getTag()...
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test public void readResponse_withListResponseContainingNil() throws Exception { ImapResponseParser parser = createParser("* LIST (\\NoInferiors) NIL INBOX\r\n"); ImapResponse response = parser.readResponse(); assertEquals(4, response.size()); assertEquals("LIST", response.get(0)); assertEquals(1, response.getList(1)....
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test public void readResponse_withListAsFirstToken_shouldThrow() throws Exception { ImapResponseParser parser = createParser("* [1 2] 3\r\n"); try { parser.readResponse(); fail("Expected exception"); } catch (IOException e) { assertEquals("Unexpected non-string token: ImapList - [1, 2]", e.getMessage()); } }
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test public void testFetchResponse() throws Exception { ImapResponseParser parser = createParser("* 1 FETCH (" + "UID 23 " + "INTERNALDATE \"01-Jul-2015 12:34:56 +0200\" " + "RFC822.SIZE 3456 " + "BODY[HEADER.FIELDS (date subject from)] \"<headers>\" " + "FLAGS (\\Seen))\r\n"); ImapResponse response = parser.readRespo...
public ImapResponse readResponse() throws IOException { return readResponse(null); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
ImapResponseParser { public ImapResponse readResponse() throws IOException { return readResponse(null); } ImapResponseParser(PeekableInputStream in); ImapResponse readResponse(); ImapResponse readResponse(ImapResponseCallback callback); }
@Test public void readStatusResponse_withNoResponse_shouldThrow() throws Exception { ImapResponseParser parser = createParser("1 NO\r\n"); try { parser.readStatusResponse("1", "COMMAND", "[logId]", null); fail("Expected exception"); } catch (NegativeImapResponseException e) { assertEquals("Command: COMMAND; response: #...
List<ImapResponse> readStatusResponse(String tag, String commandToLog, String logId, UntaggedHandler untaggedHandler) throws IOException, NegativeImapResponseException { List<ImapResponse> responses = new ArrayList<ImapResponse>(); ImapResponse response; do { response = readResponse(); if (K9MailLib.isDebug() && DEBUG_...
ImapResponseParser { List<ImapResponse> readStatusResponse(String tag, String commandToLog, String logId, UntaggedHandler untaggedHandler) throws IOException, NegativeImapResponseException { List<ImapResponse> responses = new ArrayList<ImapResponse>(); ImapResponse response; do { response = readResponse(); if (K9MailLi...
ImapResponseParser { List<ImapResponse> readStatusResponse(String tag, String commandToLog, String logId, UntaggedHandler untaggedHandler) throws IOException, NegativeImapResponseException { List<ImapResponse> responses = new ArrayList<ImapResponse>(); ImapResponse response; do { response = readResponse(); if (K9MailLi...
ImapResponseParser { List<ImapResponse> readStatusResponse(String tag, String commandToLog, String logId, UntaggedHandler untaggedHandler) throws IOException, NegativeImapResponseException { List<ImapResponse> responses = new ArrayList<ImapResponse>(); ImapResponse response; do { response = readResponse(); if (K9MailLi...
ImapResponseParser { List<ImapResponse> readStatusResponse(String tag, String commandToLog, String logId, UntaggedHandler untaggedHandler) throws IOException, NegativeImapResponseException { List<ImapResponse> responses = new ArrayList<ImapResponse>(); ImapResponse response; do { response = readResponse(); if (K9MailLi...
@Test public void readStatusResponse_withNoResponseAndAlertText_shouldThrowWithAlertText() throws Exception { ImapResponseParser parser = createParser("1 NO [ALERT] Access denied\r\n"); try { parser.readStatusResponse("1", "COMMAND", "[logId]", null); fail("Expected exception"); } catch (NegativeImapResponseException e...
List<ImapResponse> readStatusResponse(String tag, String commandToLog, String logId, UntaggedHandler untaggedHandler) throws IOException, NegativeImapResponseException { List<ImapResponse> responses = new ArrayList<ImapResponse>(); ImapResponse response; do { response = readResponse(); if (K9MailLib.isDebug() && DEBUG_...
ImapResponseParser { List<ImapResponse> readStatusResponse(String tag, String commandToLog, String logId, UntaggedHandler untaggedHandler) throws IOException, NegativeImapResponseException { List<ImapResponse> responses = new ArrayList<ImapResponse>(); ImapResponse response; do { response = readResponse(); if (K9MailLi...
ImapResponseParser { List<ImapResponse> readStatusResponse(String tag, String commandToLog, String logId, UntaggedHandler untaggedHandler) throws IOException, NegativeImapResponseException { List<ImapResponse> responses = new ArrayList<ImapResponse>(); ImapResponse response; do { response = readResponse(); if (K9MailLi...
ImapResponseParser { List<ImapResponse> readStatusResponse(String tag, String commandToLog, String logId, UntaggedHandler untaggedHandler) throws IOException, NegativeImapResponseException { List<ImapResponse> responses = new ArrayList<ImapResponse>(); ImapResponse response; do { response = readResponse(); if (K9MailLi...
ImapResponseParser { List<ImapResponse> readStatusResponse(String tag, String commandToLog, String logId, UntaggedHandler untaggedHandler) throws IOException, NegativeImapResponseException { List<ImapResponse> responses = new ArrayList<ImapResponse>(); ImapResponse response; do { response = readResponse(); if (K9MailLi...
@Test public void mergeConsecutiveBreaksIntoOne() { String text = "hello\n------------\n---------------\nfoo bar"; String result = HtmlConverter.textToHtml(text); assertEquals("<pre class=\"k9mail\">hello<hr>foo bar</pre>", result); }
public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesThisLine = 0; for ...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
@Test public void start_withSingleFolderName_shouldCreateImapFolderPusherAndCallStartOnIt() throws Exception { List<String> folderNames = Collections.singletonList("INBOX"); imapPusher.start(folderNames); List<ImapFolderPusher> imapFolderPushers = imapPusher.getImapFolderPushers(); assertEquals(1, imapFolderPushers.siz...
@Override public void start(List<String> folderNames) { synchronized (folderPushers) { stop(); setLastRefresh(currentTimeMillis()); for (String folderName : folderNames) { ImapFolderPusher pusher = createImapFolderPusher(folderName); folderPushers.add(pusher); pusher.start(); } } }
ImapPusher implements Pusher { @Override public void start(List<String> folderNames) { synchronized (folderPushers) { stop(); setLastRefresh(currentTimeMillis()); for (String folderName : folderNames) { ImapFolderPusher pusher = createImapFolderPusher(folderName); folderPushers.add(pusher); pusher.start(); } } } }
ImapPusher implements Pusher { @Override public void start(List<String> folderNames) { synchronized (folderPushers) { stop(); setLastRefresh(currentTimeMillis()); for (String folderName : folderNames) { ImapFolderPusher pusher = createImapFolderPusher(folderName); folderPushers.add(pusher); pusher.start(); } } } ImapPu...
ImapPusher implements Pusher { @Override public void start(List<String> folderNames) { synchronized (folderPushers) { stop(); setLastRefresh(currentTimeMillis()); for (String folderName : folderNames) { ImapFolderPusher pusher = createImapFolderPusher(folderName); folderPushers.add(pusher); pusher.start(); } } } ImapPu...
ImapPusher implements Pusher { @Override public void start(List<String> folderNames) { synchronized (folderPushers) { stop(); setLastRefresh(currentTimeMillis()); for (String folderName : folderNames) { ImapFolderPusher pusher = createImapFolderPusher(folderName); folderPushers.add(pusher); pusher.start(); } } } ImapPu...
@Test public void start_withTwoFolderNames_shouldCreateTwoImapFolderPushersAndCallStart() throws Exception { List<String> folderNames = Arrays.asList("Important", "Drafts"); imapPusher.start(folderNames); List<ImapFolderPusher> imapFolderPushers = imapPusher.getImapFolderPushers(); assertEquals(2, imapFolderPushers.siz...
@Override public void start(List<String> folderNames) { synchronized (folderPushers) { stop(); setLastRefresh(currentTimeMillis()); for (String folderName : folderNames) { ImapFolderPusher pusher = createImapFolderPusher(folderName); folderPushers.add(pusher); pusher.start(); } } }
ImapPusher implements Pusher { @Override public void start(List<String> folderNames) { synchronized (folderPushers) { stop(); setLastRefresh(currentTimeMillis()); for (String folderName : folderNames) { ImapFolderPusher pusher = createImapFolderPusher(folderName); folderPushers.add(pusher); pusher.start(); } } } }
ImapPusher implements Pusher { @Override public void start(List<String> folderNames) { synchronized (folderPushers) { stop(); setLastRefresh(currentTimeMillis()); for (String folderName : folderNames) { ImapFolderPusher pusher = createImapFolderPusher(folderName); folderPushers.add(pusher); pusher.start(); } } } ImapPu...
ImapPusher implements Pusher { @Override public void start(List<String> folderNames) { synchronized (folderPushers) { stop(); setLastRefresh(currentTimeMillis()); for (String folderName : folderNames) { ImapFolderPusher pusher = createImapFolderPusher(folderName); folderPushers.add(pusher); pusher.start(); } } } ImapPu...
ImapPusher implements Pusher { @Override public void start(List<String> folderNames) { synchronized (folderPushers) { stop(); setLastRefresh(currentTimeMillis()); for (String folderName : folderNames) { ImapFolderPusher pusher = createImapFolderPusher(folderName); folderPushers.add(pusher); pusher.start(); } } } ImapPu...
@Test public void stop_withoutStartBeingCalled_shouldNotCreateAnyImapFolderPushers() throws Exception { imapPusher.stop(); List<ImapFolderPusher> imapFolderPushers = imapPusher.getImapFolderPushers(); assertEquals(0, imapFolderPushers.size()); }
@Override public void stop() { if (K9MailLib.isDebug()) { Timber.i("Requested stop of IMAP pusher"); } synchronized (folderPushers) { for (ImapFolderPusher folderPusher : folderPushers) { try { if (K9MailLib.isDebug()) { Timber.i("Requesting stop of IMAP folderPusher %s", folderPusher.getId()); } folderPusher.stop(); }...
ImapPusher implements Pusher { @Override public void stop() { if (K9MailLib.isDebug()) { Timber.i("Requested stop of IMAP pusher"); } synchronized (folderPushers) { for (ImapFolderPusher folderPusher : folderPushers) { try { if (K9MailLib.isDebug()) { Timber.i("Requesting stop of IMAP folderPusher %s", folderPusher.get...
ImapPusher implements Pusher { @Override public void stop() { if (K9MailLib.isDebug()) { Timber.i("Requested stop of IMAP pusher"); } synchronized (folderPushers) { for (ImapFolderPusher folderPusher : folderPushers) { try { if (K9MailLib.isDebug()) { Timber.i("Requesting stop of IMAP folderPusher %s", folderPusher.get...
ImapPusher implements Pusher { @Override public void stop() { if (K9MailLib.isDebug()) { Timber.i("Requested stop of IMAP pusher"); } synchronized (folderPushers) { for (ImapFolderPusher folderPusher : folderPushers) { try { if (K9MailLib.isDebug()) { Timber.i("Requesting stop of IMAP folderPusher %s", folderPusher.get...
ImapPusher implements Pusher { @Override public void stop() { if (K9MailLib.isDebug()) { Timber.i("Requested stop of IMAP pusher"); } synchronized (folderPushers) { for (ImapFolderPusher folderPusher : folderPushers) { try { if (K9MailLib.isDebug()) { Timber.i("Requesting stop of IMAP folderPusher %s", folderPusher.get...
@Test public void getRefreshInterval() throws Exception { StoreConfig storeConfig = mock(StoreConfig.class); when(storeConfig.getIdleRefreshMinutes()).thenReturn(23); when(imapStore.getStoreConfig()).thenReturn(storeConfig); int result = imapPusher.getRefreshInterval(); assertEquals(23 * 60 * 1000, result); }
@Override public int getRefreshInterval() { return (store.getStoreConfig().getIdleRefreshMinutes() * 60 * 1000); }
ImapPusher implements Pusher { @Override public int getRefreshInterval() { return (store.getStoreConfig().getIdleRefreshMinutes() * 60 * 1000); } }
ImapPusher implements Pusher { @Override public int getRefreshInterval() { return (store.getStoreConfig().getIdleRefreshMinutes() * 60 * 1000); } ImapPusher(ImapStore store, PushReceiver pushReceiver); }
ImapPusher implements Pusher { @Override public int getRefreshInterval() { return (store.getStoreConfig().getIdleRefreshMinutes() * 60 * 1000); } ImapPusher(ImapStore store, PushReceiver pushReceiver); @Override void start(List<String> folderNames); @Override void refresh(); @Override void stop(); @Override int getRefr...
ImapPusher implements Pusher { @Override public int getRefreshInterval() { return (store.getStoreConfig().getIdleRefreshMinutes() * 60 * 1000); } ImapPusher(ImapStore store, PushReceiver pushReceiver); @Override void start(List<String> folderNames); @Override void refresh(); @Override void stop(); @Override int getRefr...
@Test public void getLastRefresh_shouldBeMinusOneInitially() throws Exception { long result = imapPusher.getLastRefresh(); assertEquals(-1L, result); }
@Override public long getLastRefresh() { return lastRefresh; }
ImapPusher implements Pusher { @Override public long getLastRefresh() { return lastRefresh; } }
ImapPusher implements Pusher { @Override public long getLastRefresh() { return lastRefresh; } ImapPusher(ImapStore store, PushReceiver pushReceiver); }
ImapPusher implements Pusher { @Override public long getLastRefresh() { return lastRefresh; } ImapPusher(ImapStore store, PushReceiver pushReceiver); @Override void start(List<String> folderNames); @Override void refresh(); @Override void stop(); @Override int getRefreshInterval(); @Override long getLastRefresh(); @Ove...
ImapPusher implements Pusher { @Override public long getLastRefresh() { return lastRefresh; } ImapPusher(ImapStore store, PushReceiver pushReceiver); @Override void start(List<String> folderNames); @Override void refresh(); @Override void stop(); @Override int getRefreshInterval(); @Override long getLastRefresh(); @Ove...
@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")); }
public boolean containsKey(String key) { if (key == null) { return false; } for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return true; } } return false; }
ImapList extends ArrayList<Object> { public boolean containsKey(String key) { if (key == null) { return false; } for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return true; } } return false; } }
ImapList extends ArrayList<Object> { public boolean containsKey(String key) { if (key == null) { return false; } for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return true; } } return false; } }
ImapList extends ArrayList<Object> { public boolean containsKey(String key) { if (key == null) { return false; } for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return true; } } return false; } ImapList getList(int index); boolean isList(int index); Object ...
ImapList extends ArrayList<Object> { public boolean containsKey(String key) { if (key == null) { return false; } for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return true; } } return false; } ImapList getList(int index); boolean isList(int index); Object ...
@Test public void containsKey_returnsFalseForStringThatCantBeKey() throws IOException { ImapList list = buildSampleList(); assertFalse(list.containsKey("THREE")); }
public boolean containsKey(String key) { if (key == null) { return false; } for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return true; } } return false; }
ImapList extends ArrayList<Object> { public boolean containsKey(String key) { if (key == null) { return false; } for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return true; } } return false; } }
ImapList extends ArrayList<Object> { public boolean containsKey(String key) { if (key == null) { return false; } for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return true; } } return false; } }
ImapList extends ArrayList<Object> { public boolean containsKey(String key) { if (key == null) { return false; } for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return true; } } return false; } ImapList getList(int index); boolean isList(int index); Object ...
ImapList extends ArrayList<Object> { public boolean containsKey(String key) { if (key == null) { return false; } for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return true; } } return false; } ImapList getList(int index); boolean isList(int index); Object ...
@Test public void containsKey_returnsFalseForStringNotInList() throws IOException { ImapList list = buildSampleList(); assertFalse(list.containsKey("nonexistent")); }
public boolean containsKey(String key) { if (key == null) { return false; } for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return true; } } return false; }
ImapList extends ArrayList<Object> { public boolean containsKey(String key) { if (key == null) { return false; } for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return true; } } return false; } }
ImapList extends ArrayList<Object> { public boolean containsKey(String key) { if (key == null) { return false; } for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return true; } } return false; } }
ImapList extends ArrayList<Object> { public boolean containsKey(String key) { if (key == null) { return false; } for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return true; } } return false; } ImapList getList(int index); boolean isList(int index); Object ...
ImapList extends ArrayList<Object> { public boolean containsKey(String key) { if (key == null) { return false; } for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return true; } } return false; } ImapList getList(int index); boolean isList(int index); Object ...
@Test public void getKeyedValue_providesCorrespondingValues() { ImapList list = buildSampleList(); assertEquals("TWO", list.getKeyedValue("ONE")); assertEquals("THREE", list.getKeyedValue("TWO")); assertNull(list.getKeyedValue("THREE")); assertNull(list.getKeyedValue("nonexistent")); }
public Object getKeyedValue(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return get(i + 1); } } return null; }
ImapList extends ArrayList<Object> { public Object getKeyedValue(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return get(i + 1); } } return null; } }
ImapList extends ArrayList<Object> { public Object getKeyedValue(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return get(i + 1); } } return null; } }
ImapList extends ArrayList<Object> { public Object getKeyedValue(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return get(i + 1); } } return null; } ImapList getList(int index); boolean isList(int index); Object getObject(int index); String ...
ImapList extends ArrayList<Object> { public Object getKeyedValue(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return get(i + 1); } } return null; } ImapList getList(int index); boolean isList(int index); Object getObject(int index); String ...
@Test public void getKeyIndex_providesIndexForKeys() { ImapList list = buildSampleList(); assertEquals(0, list.getKeyIndex("ONE")); assertEquals(1, list.getKeyIndex("TWO")); }
public int getKeyIndex(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return i; } } throw new IllegalArgumentException("getKeyIndex() only works for keys that are in the collection."); }
ImapList extends ArrayList<Object> { public int getKeyIndex(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return i; } } throw new IllegalArgumentException("getKeyIndex() only works for keys that are in the collection."); } }
ImapList extends ArrayList<Object> { public int getKeyIndex(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return i; } } throw new IllegalArgumentException("getKeyIndex() only works for keys that are in the collection."); } }
ImapList extends ArrayList<Object> { public int getKeyIndex(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return i; } } throw new IllegalArgumentException("getKeyIndex() only works for keys that are in the collection."); } ImapList getList(i...
ImapList extends ArrayList<Object> { public int getKeyIndex(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return i; } } throw new IllegalArgumentException("getKeyIndex() only works for keys that are in the collection."); } ImapList getList(i...
@Test public void dashedHorizontalRulePrefixedWithTextIgnoredAsHR() { String text = "hello----\n\n"; String result = HtmlConverter.textToHtml(text); assertEquals("<pre class=\"k9mail\">hello----<br /><br /></pre>", result); }
public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesThisLine = 0; for ...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
@Test(expected = IllegalArgumentException.class) public void getKeyIndex_throwsExceptionForValue() { ImapList list = buildSampleList(); list.getKeyIndex("THREE"); }
public int getKeyIndex(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return i; } } throw new IllegalArgumentException("getKeyIndex() only works for keys that are in the collection."); }
ImapList extends ArrayList<Object> { public int getKeyIndex(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return i; } } throw new IllegalArgumentException("getKeyIndex() only works for keys that are in the collection."); } }
ImapList extends ArrayList<Object> { public int getKeyIndex(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return i; } } throw new IllegalArgumentException("getKeyIndex() only works for keys that are in the collection."); } }
ImapList extends ArrayList<Object> { public int getKeyIndex(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return i; } } throw new IllegalArgumentException("getKeyIndex() only works for keys that are in the collection."); } ImapList getList(i...
ImapList extends ArrayList<Object> { public int getKeyIndex(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return i; } } throw new IllegalArgumentException("getKeyIndex() only works for keys that are in the collection."); } ImapList getList(i...
@Test(expected = IllegalArgumentException.class) public void getKeyIndex_throwsExceptionForNonExistantKey() { ImapList list = buildSampleList(); list.getKeyIndex("nonexistent"); }
public int getKeyIndex(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return i; } } throw new IllegalArgumentException("getKeyIndex() only works for keys that are in the collection."); }
ImapList extends ArrayList<Object> { public int getKeyIndex(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return i; } } throw new IllegalArgumentException("getKeyIndex() only works for keys that are in the collection."); } }
ImapList extends ArrayList<Object> { public int getKeyIndex(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return i; } } throw new IllegalArgumentException("getKeyIndex() only works for keys that are in the collection."); } }
ImapList extends ArrayList<Object> { public int getKeyIndex(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return i; } } throw new IllegalArgumentException("getKeyIndex() only works for keys that are in the collection."); } ImapList getList(i...
ImapList extends ArrayList<Object> { public int getKeyIndex(String key) { for (int i = 0, count = size() - 1; i < count; i++) { if (ImapResponseParser.equalsIgnoreCase(get(i), key)) { return i; } } throw new IllegalArgumentException("getKeyIndex() only works for keys that are in the collection."); } ImapList getList(i...
@Test public void getDate_returnsCorrectDateForValidString() throws MessagingException { ImapList list = new ImapList(); list.add("INTERNALDATE"); list.add("10-Mar-2000 12:02:01 GMT"); Calendar c = Calendar.getInstance(); c.setTime(list.getDate(1)); assertEquals(2000, c.get(Calendar.YEAR)); assertEquals(Calendar.MARCH,...
public Date getDate(int index) throws MessagingException { return getDate(getString(index)); }
ImapList extends ArrayList<Object> { public Date getDate(int index) throws MessagingException { return getDate(getString(index)); } }
ImapList extends ArrayList<Object> { public Date getDate(int index) throws MessagingException { return getDate(getString(index)); } }
ImapList extends ArrayList<Object> { public Date getDate(int index) throws MessagingException { return getDate(getString(index)); } ImapList getList(int index); boolean isList(int index); Object getObject(int index); String getString(int index); boolean isString(int index); long getLong(int index); int getNumber(int i...
ImapList extends ArrayList<Object> { public Date getDate(int index) throws MessagingException { return getDate(getString(index)); } ImapList getList(int index); boolean isList(int index); Object getObject(int index); String getString(int index); boolean isString(int index); long getLong(int index); int getNumber(int i...
@Test(expected = MessagingException.class) public void getDate_throwsExceptionForInvalidDate() throws MessagingException { ImapList list = new ImapList(); list.add("INTERNALDATE"); list.add("InvalidDate"); list.getDate(1); }
public Date getDate(int index) throws MessagingException { return getDate(getString(index)); }
ImapList extends ArrayList<Object> { public Date getDate(int index) throws MessagingException { return getDate(getString(index)); } }
ImapList extends ArrayList<Object> { public Date getDate(int index) throws MessagingException { return getDate(getString(index)); } }
ImapList extends ArrayList<Object> { public Date getDate(int index) throws MessagingException { return getDate(getString(index)); } ImapList getList(int index); boolean isList(int index); Object getObject(int index); String getString(int index); boolean isString(int index); long getLong(int index); int getNumber(int i...
ImapList extends ArrayList<Object> { public Date getDate(int index) throws MessagingException { return getDate(getString(index)); } ImapList getList(int index); boolean isList(int index); Object getObject(int index); String getString(int index); boolean isString(int index); long getLong(int index); int getNumber(int i...
@Test public void getDate_returnsNullForNIL() throws MessagingException { ImapList list = new ImapList(); list.add("INTERNALDATE"); list.add("NIL"); assertNull(list.getDate(1)); }
public Date getDate(int index) throws MessagingException { return getDate(getString(index)); }
ImapList extends ArrayList<Object> { public Date getDate(int index) throws MessagingException { return getDate(getString(index)); } }
ImapList extends ArrayList<Object> { public Date getDate(int index) throws MessagingException { return getDate(getString(index)); } }
ImapList extends ArrayList<Object> { public Date getDate(int index) throws MessagingException { return getDate(getString(index)); } ImapList getList(int index); boolean isList(int index); Object getObject(int index); String getString(int index); boolean isString(int index); long getLong(int index); int getNumber(int i...
ImapList extends ArrayList<Object> { public Date getDate(int index) throws MessagingException { return getDate(getString(index)); } ImapList getList(int index); boolean isList(int index); Object getObject(int index); String getString(int index); boolean isString(int index); long getLong(int index); int getNumber(int i...
@Test public void getKeyedDate_returnsCorrectDateForValidString() throws MessagingException { ImapList list = new ImapList(); list.add("INTERNALDATE"); list.add("10-Mar-2000 12:02:01 GMT"); Calendar c = Calendar.getInstance(); c.setTime(list.getKeyedDate("INTERNALDATE")); assertEquals(2000, c.get(Calendar.YEAR)); asser...
public Date getKeyedDate(String key) throws MessagingException { return getDate(getKeyedString(key)); }
ImapList extends ArrayList<Object> { public Date getKeyedDate(String key) throws MessagingException { return getDate(getKeyedString(key)); } }
ImapList extends ArrayList<Object> { public Date getKeyedDate(String key) throws MessagingException { return getDate(getKeyedString(key)); } }
ImapList extends ArrayList<Object> { public Date getKeyedDate(String key) throws MessagingException { return getDate(getKeyedString(key)); } ImapList getList(int index); boolean isList(int index); Object getObject(int index); String getString(int index); boolean isString(int index); long getLong(int index); int getNum...
ImapList extends ArrayList<Object> { public Date getKeyedDate(String key) throws MessagingException { return getDate(getKeyedString(key)); } ImapList getList(int index); boolean isList(int index); Object getObject(int index); String getString(int index); boolean isString(int index); long getLong(int index); int getNum...
@Test(expected = MessagingException.class) public void getKeyedDate_throwsExceptionForInvalidDate() throws MessagingException { ImapList list = new ImapList(); list.add("INTERNALDATE"); list.add("InvalidDate"); list.getKeyedDate("INTERNALDATE"); }
public Date getKeyedDate(String key) throws MessagingException { return getDate(getKeyedString(key)); }
ImapList extends ArrayList<Object> { public Date getKeyedDate(String key) throws MessagingException { return getDate(getKeyedString(key)); } }
ImapList extends ArrayList<Object> { public Date getKeyedDate(String key) throws MessagingException { return getDate(getKeyedString(key)); } }
ImapList extends ArrayList<Object> { public Date getKeyedDate(String key) throws MessagingException { return getDate(getKeyedString(key)); } ImapList getList(int index); boolean isList(int index); Object getObject(int index); String getString(int index); boolean isString(int index); long getLong(int index); int getNum...
ImapList extends ArrayList<Object> { public Date getKeyedDate(String key) throws MessagingException { return getDate(getKeyedString(key)); } ImapList getList(int index); boolean isList(int index); Object getObject(int index); String getString(int index); boolean isString(int index); long getLong(int index); int getNum...
@Test public void getKeyedDate_returnsNullForNIL() throws MessagingException { ImapList list = new ImapList(); list.add("INTERNALDATE"); list.add("NIL"); assertNull(list.getKeyedDate("INTERNALDATE")); }
public Date getKeyedDate(String key) throws MessagingException { return getDate(getKeyedString(key)); }
ImapList extends ArrayList<Object> { public Date getKeyedDate(String key) throws MessagingException { return getDate(getKeyedString(key)); } }
ImapList extends ArrayList<Object> { public Date getKeyedDate(String key) throws MessagingException { return getDate(getKeyedString(key)); } }
ImapList extends ArrayList<Object> { public Date getKeyedDate(String key) throws MessagingException { return getDate(getKeyedString(key)); } ImapList getList(int index); boolean isList(int index); Object getObject(int index); String getString(int index); boolean isString(int index); long getLong(int index); int getNum...
ImapList extends ArrayList<Object> { public Date getKeyedDate(String key) throws MessagingException { return getDate(getKeyedString(key)); } ImapList getList(int index); boolean isList(int index); Object getObject(int index); String getString(int index); boolean isString(int index); long getLong(int index); int getNum...
@Test public void parse_withUntaggedResponse_shouldReturnNull() throws Exception { ImapResponse imapResponse = createImapResponse("* OK [READ-WRITE] Select completed."); SelectOrExamineResponse result = SelectOrExamineResponse.parse(imapResponse); assertNull(result); }
public static SelectOrExamineResponse parse(ImapResponse response) { if (!response.isTagged() || !equalsIgnoreCase(response.get(0), Responses.OK)) { return null; } if (!response.isList(1)) { return noOpenModeInResponse(); } ImapList responseTextList = response.getList(1); if (!responseTextList.isString(0)) { return noO...
SelectOrExamineResponse { public static SelectOrExamineResponse parse(ImapResponse response) { if (!response.isTagged() || !equalsIgnoreCase(response.get(0), Responses.OK)) { return null; } if (!response.isList(1)) { return noOpenModeInResponse(); } ImapList responseTextList = response.getList(1); if (!responseTextList...
SelectOrExamineResponse { public static SelectOrExamineResponse parse(ImapResponse response) { if (!response.isTagged() || !equalsIgnoreCase(response.get(0), Responses.OK)) { return null; } if (!response.isList(1)) { return noOpenModeInResponse(); } ImapList responseTextList = response.getList(1); if (!responseTextList...
SelectOrExamineResponse { public static SelectOrExamineResponse parse(ImapResponse response) { if (!response.isTagged() || !equalsIgnoreCase(response.get(0), Responses.OK)) { return null; } if (!response.isList(1)) { return noOpenModeInResponse(); } ImapList responseTextList = response.getList(1); if (!responseTextList...
SelectOrExamineResponse { public static SelectOrExamineResponse parse(ImapResponse response) { if (!response.isTagged() || !equalsIgnoreCase(response.get(0), Responses.OK)) { return null; } if (!response.isList(1)) { return noOpenModeInResponse(); } ImapList responseTextList = response.getList(1); if (!responseTextList...
@Test public void parse_withoutOkResponse_shouldReturnNull() throws Exception { ImapResponse imapResponse = createImapResponse("x BYE"); SelectOrExamineResponse result = SelectOrExamineResponse.parse(imapResponse); assertNull(result); }
public static SelectOrExamineResponse parse(ImapResponse response) { if (!response.isTagged() || !equalsIgnoreCase(response.get(0), Responses.OK)) { return null; } if (!response.isList(1)) { return noOpenModeInResponse(); } ImapList responseTextList = response.getList(1); if (!responseTextList.isString(0)) { return noO...
SelectOrExamineResponse { public static SelectOrExamineResponse parse(ImapResponse response) { if (!response.isTagged() || !equalsIgnoreCase(response.get(0), Responses.OK)) { return null; } if (!response.isList(1)) { return noOpenModeInResponse(); } ImapList responseTextList = response.getList(1); if (!responseTextList...
SelectOrExamineResponse { public static SelectOrExamineResponse parse(ImapResponse response) { if (!response.isTagged() || !equalsIgnoreCase(response.get(0), Responses.OK)) { return null; } if (!response.isList(1)) { return noOpenModeInResponse(); } ImapList responseTextList = response.getList(1); if (!responseTextList...
SelectOrExamineResponse { public static SelectOrExamineResponse parse(ImapResponse response) { if (!response.isTagged() || !equalsIgnoreCase(response.get(0), Responses.OK)) { return null; } if (!response.isList(1)) { return noOpenModeInResponse(); } ImapList responseTextList = response.getList(1); if (!responseTextList...
SelectOrExamineResponse { public static SelectOrExamineResponse parse(ImapResponse response) { if (!response.isTagged() || !equalsIgnoreCase(response.get(0), Responses.OK)) { return null; } if (!response.isList(1)) { return noOpenModeInResponse(); } ImapList responseTextList = response.getList(1); if (!responseTextList...
@Test public void doubleMinusIgnoredAsHR() { String text = "--\n"; String result = HtmlConverter.textToHtml(text); assertEquals("<pre class=\"k9mail\">--<br /></pre>", result); }
public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesThisLine = 0; for ...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
@Test public void open_calledTwice_shouldReuseSameImapConnection() throws Exception { ImapFolder imapFolder = createFolder("Folder"); prepareImapFolderForOpen(OPEN_MODE_RW); imapFolder.open(OPEN_MODE_RW); imapFolder.open(OPEN_MODE_RW); verify(imapStore, times(1)).getConnection(); }
@Override public void open(int mode) throws MessagingException { internalOpen(mode); if (messageCount == -1) { throw new MessagingException("Did not find message count during open"); } }
ImapFolder extends Folder<ImapMessage> { @Override public void open(int mode) throws MessagingException { internalOpen(mode); if (messageCount == -1) { throw new MessagingException("Did not find message count during open"); } } }
ImapFolder extends Folder<ImapMessage> { @Override public void open(int mode) throws MessagingException { internalOpen(mode); if (messageCount == -1) { throw new MessagingException("Did not find message count during open"); } } ImapFolder(ImapStore store, String id); ImapFolder(ImapStore store, String id, FolderNameC...
ImapFolder extends Folder<ImapMessage> { @Override public void open(int mode) throws MessagingException { internalOpen(mode); if (messageCount == -1) { throw new MessagingException("Did not find message count during open"); } } ImapFolder(ImapStore store, String id); ImapFolder(ImapStore store, String id, FolderNameC...
ImapFolder extends Folder<ImapMessage> { @Override public void open(int mode) throws MessagingException { internalOpen(mode); if (messageCount == -1) { throw new MessagingException("Did not find message count during open"); } } ImapFolder(ImapStore store, String id); ImapFolder(ImapStore store, String id, FolderNameC...
@Test public void exists_withoutNegativeImapResponse_shouldReturnTrue() throws Exception { ImapFolder imapFolder = createFolder("Folder"); when(imapStore.getConnection()).thenReturn(imapConnection); boolean folderExists = imapFolder.exists(); assertTrue(folderExists); }
private boolean exists(String escapedFolderName) throws MessagingException { try { connection.executeSimpleCommand(String.format("STATUS %s (RECENT)", escapedFolderName)); return true; } catch (IOException ioe) { throw ioExceptionHandler(connection, ioe); } catch (NegativeImapResponseException e) { return false; } }
ImapFolder extends Folder<ImapMessage> { private boolean exists(String escapedFolderName) throws MessagingException { try { connection.executeSimpleCommand(String.format("STATUS %s (RECENT)", escapedFolderName)); return true; } catch (IOException ioe) { throw ioExceptionHandler(connection, ioe); } catch (NegativeImapRe...
ImapFolder extends Folder<ImapMessage> { private boolean exists(String escapedFolderName) throws MessagingException { try { connection.executeSimpleCommand(String.format("STATUS %s (RECENT)", escapedFolderName)); return true; } catch (IOException ioe) { throw ioExceptionHandler(connection, ioe); } catch (NegativeImapRe...
ImapFolder extends Folder<ImapMessage> { private boolean exists(String escapedFolderName) throws MessagingException { try { connection.executeSimpleCommand(String.format("STATUS %s (RECENT)", escapedFolderName)); return true; } catch (IOException ioe) { throw ioExceptionHandler(connection, ioe); } catch (NegativeImapRe...
ImapFolder extends Folder<ImapMessage> { private boolean exists(String escapedFolderName) throws MessagingException { try { connection.executeSimpleCommand(String.format("STATUS %s (RECENT)", escapedFolderName)); return true; } catch (IOException ioe) { throw ioExceptionHandler(connection, ioe); } catch (NegativeImapRe...
@Test public void create_withoutNegativeImapResponse_shouldReturnTrue() throws Exception { ImapFolder imapFolder = createFolder("Folder"); when(imapStore.getConnection()).thenReturn(imapConnection); boolean success = imapFolder.create(FolderType.HOLDS_MESSAGES); assertTrue(success); }
@Override public boolean create(FolderType type) throws MessagingException { ImapConnection connection; synchronized (this) { if (this.connection == null) { connection = store.getConnection(); } else { connection = this.connection; } } try { String encodedFolderName = folderNameCodec.encode(getPrefixedId()); String esc...
ImapFolder extends Folder<ImapMessage> { @Override public boolean create(FolderType type) throws MessagingException { ImapConnection connection; synchronized (this) { if (this.connection == null) { connection = store.getConnection(); } else { connection = this.connection; } } try { String encodedFolderName = folderName...
ImapFolder extends Folder<ImapMessage> { @Override public boolean create(FolderType type) throws MessagingException { ImapConnection connection; synchronized (this) { if (this.connection == null) { connection = store.getConnection(); } else { connection = this.connection; } } try { String encodedFolderName = folderName...
ImapFolder extends Folder<ImapMessage> { @Override public boolean create(FolderType type) throws MessagingException { ImapConnection connection; synchronized (this) { if (this.connection == null) { connection = store.getConnection(); } else { connection = this.connection; } } try { String encodedFolderName = folderName...
ImapFolder extends Folder<ImapMessage> { @Override public boolean create(FolderType type) throws MessagingException { ImapConnection connection; synchronized (this) { if (this.connection == null) { connection = store.getConnection(); } else { connection = this.connection; } } try { String encodedFolderName = folderName...
@Test public void copyMessages_withEmptyMessageList_shouldReturnNull() throws Exception { ImapFolder sourceFolder = createFolder("Source"); ImapFolder destinationFolder = createFolder("Destination"); List<ImapMessage> messages = Collections.emptyList(); Map<String, String> uidMapping = sourceFolder.copyMessages(message...
@Override public Map<String, String> copyMessages(List<? extends Message> messages, Folder folder) throws MessagingException { if (!(folder instanceof ImapFolder)) { throw new MessagingException("ImapFolder.copyMessages passed non-ImapFolder"); } if (messages.isEmpty()) { return null; } ImapFolder imapFolder = (ImapFol...
ImapFolder extends Folder<ImapMessage> { @Override public Map<String, String> copyMessages(List<? extends Message> messages, Folder folder) throws MessagingException { if (!(folder instanceof ImapFolder)) { throw new MessagingException("ImapFolder.copyMessages passed non-ImapFolder"); } if (messages.isEmpty()) { return...
ImapFolder extends Folder<ImapMessage> { @Override public Map<String, String> copyMessages(List<? extends Message> messages, Folder folder) throws MessagingException { if (!(folder instanceof ImapFolder)) { throw new MessagingException("ImapFolder.copyMessages passed non-ImapFolder"); } if (messages.isEmpty()) { return...
ImapFolder extends Folder<ImapMessage> { @Override public Map<String, String> copyMessages(List<? extends Message> messages, Folder folder) throws MessagingException { if (!(folder instanceof ImapFolder)) { throw new MessagingException("ImapFolder.copyMessages passed non-ImapFolder"); } if (messages.isEmpty()) { return...
ImapFolder extends Folder<ImapMessage> { @Override public Map<String, String> copyMessages(List<? extends Message> messages, Folder folder) throws MessagingException { if (!(folder instanceof ImapFolder)) { throw new MessagingException("ImapFolder.copyMessages passed non-ImapFolder"); } if (messages.isEmpty()) { return...
@Test public void copyMessages() throws Exception { ImapFolder sourceFolder = createFolder("Folder"); prepareImapFolderForOpen(OPEN_MODE_RW); ImapFolder destinationFolder = createFolder("Destination"); List<ImapMessage> messages = singletonList(createImapMessage("1")); List<ImapResponse> copyResponses = singletonList( ...
@Override public Map<String, String> copyMessages(List<? extends Message> messages, Folder folder) throws MessagingException { if (!(folder instanceof ImapFolder)) { throw new MessagingException("ImapFolder.copyMessages passed non-ImapFolder"); } if (messages.isEmpty()) { return null; } ImapFolder imapFolder = (ImapFol...
ImapFolder extends Folder<ImapMessage> { @Override public Map<String, String> copyMessages(List<? extends Message> messages, Folder folder) throws MessagingException { if (!(folder instanceof ImapFolder)) { throw new MessagingException("ImapFolder.copyMessages passed non-ImapFolder"); } if (messages.isEmpty()) { return...
ImapFolder extends Folder<ImapMessage> { @Override public Map<String, String> copyMessages(List<? extends Message> messages, Folder folder) throws MessagingException { if (!(folder instanceof ImapFolder)) { throw new MessagingException("ImapFolder.copyMessages passed non-ImapFolder"); } if (messages.isEmpty()) { return...
ImapFolder extends Folder<ImapMessage> { @Override public Map<String, String> copyMessages(List<? extends Message> messages, Folder folder) throws MessagingException { if (!(folder instanceof ImapFolder)) { throw new MessagingException("ImapFolder.copyMessages passed non-ImapFolder"); } if (messages.isEmpty()) { return...
ImapFolder extends Folder<ImapMessage> { @Override public Map<String, String> copyMessages(List<? extends Message> messages, Folder folder) throws MessagingException { if (!(folder instanceof ImapFolder)) { throw new MessagingException("ImapFolder.copyMessages passed non-ImapFolder"); } if (messages.isEmpty()) { return...
@Test public void moveMessages_withEmptyMessageList_shouldReturnNull() throws Exception { ImapFolder sourceFolder = createFolder("Source"); ImapFolder destinationFolder = createFolder("Destination"); List<ImapMessage> messages = Collections.emptyList(); Map<String, String> uidMapping = sourceFolder.moveMessages(message...
@Override public Map<String, String> moveMessages(List<? extends Message> messages, Folder folder) throws MessagingException { if (messages.isEmpty()) { return null; } Map<String, String> uidMapping = copyMessages(messages, folder); setFlags(messages, Collections.singleton(Flag.DELETED), true); return uidMapping; }
ImapFolder extends Folder<ImapMessage> { @Override public Map<String, String> moveMessages(List<? extends Message> messages, Folder folder) throws MessagingException { if (messages.isEmpty()) { return null; } Map<String, String> uidMapping = copyMessages(messages, folder); setFlags(messages, Collections.singleton(Flag....
ImapFolder extends Folder<ImapMessage> { @Override public Map<String, String> moveMessages(List<? extends Message> messages, Folder folder) throws MessagingException { if (messages.isEmpty()) { return null; } Map<String, String> uidMapping = copyMessages(messages, folder); setFlags(messages, Collections.singleton(Flag....
ImapFolder extends Folder<ImapMessage> { @Override public Map<String, String> moveMessages(List<? extends Message> messages, Folder folder) throws MessagingException { if (messages.isEmpty()) { return null; } Map<String, String> uidMapping = copyMessages(messages, folder); setFlags(messages, Collections.singleton(Flag....
ImapFolder extends Folder<ImapMessage> { @Override public Map<String, String> moveMessages(List<? extends Message> messages, Folder folder) throws MessagingException { if (messages.isEmpty()) { return null; } Map<String, String> uidMapping = copyMessages(messages, folder); setFlags(messages, Collections.singleton(Flag....
@Test public void delete_withEmptyMessageList_shouldNotInteractWithImapConnection() throws Exception { ImapFolder folder = createFolder("Source"); List<ImapMessage> messages = Collections.emptyList(); folder.delete(messages, "Trash"); verifyNoMoreInteractions(imapConnection); }
@Override public void delete(List<? extends Message> messages, String trashFolderName) throws MessagingException { if (messages.isEmpty()) { return; } if (trashFolderName == null || getId().equalsIgnoreCase(trashFolderName)) { setFlags(messages, Collections.singleton(Flag.DELETED), true); } else { ImapFolder remoteTras...
ImapFolder extends Folder<ImapMessage> { @Override public void delete(List<? extends Message> messages, String trashFolderName) throws MessagingException { if (messages.isEmpty()) { return; } if (trashFolderName == null || getId().equalsIgnoreCase(trashFolderName)) { setFlags(messages, Collections.singleton(Flag.DELETE...
ImapFolder extends Folder<ImapMessage> { @Override public void delete(List<? extends Message> messages, String trashFolderName) throws MessagingException { if (messages.isEmpty()) { return; } if (trashFolderName == null || getId().equalsIgnoreCase(trashFolderName)) { setFlags(messages, Collections.singleton(Flag.DELETE...
ImapFolder extends Folder<ImapMessage> { @Override public void delete(List<? extends Message> messages, String trashFolderName) throws MessagingException { if (messages.isEmpty()) { return; } if (trashFolderName == null || getId().equalsIgnoreCase(trashFolderName)) { setFlags(messages, Collections.singleton(Flag.DELETE...
ImapFolder extends Folder<ImapMessage> { @Override public void delete(List<? extends Message> messages, String trashFolderName) throws MessagingException { if (messages.isEmpty()) { return; } if (trashFolderName == null || getId().equalsIgnoreCase(trashFolderName)) { setFlags(messages, Collections.singleton(Flag.DELETE...
@Test public void getUnreadMessageCount_withClosedFolder_shouldThrow() throws Exception { ImapFolder folder = createFolder("Folder"); when(imapStore.getConnection()).thenReturn(imapConnection); try { folder.getUnreadMessageCount(); fail("Expected exception"); } catch (MessagingException e) { assertCheckOpenErrorMessage...
@Override public int getUnreadMessageCount() throws MessagingException { return getRemoteMessageCount("UNSEEN NOT DELETED"); }
ImapFolder extends Folder<ImapMessage> { @Override public int getUnreadMessageCount() throws MessagingException { return getRemoteMessageCount("UNSEEN NOT DELETED"); } }
ImapFolder extends Folder<ImapMessage> { @Override public int getUnreadMessageCount() throws MessagingException { return getRemoteMessageCount("UNSEEN NOT DELETED"); } ImapFolder(ImapStore store, String id); ImapFolder(ImapStore store, String id, FolderNameCodec folderNameCodec); }
ImapFolder extends Folder<ImapMessage> { @Override public int getUnreadMessageCount() throws MessagingException { return getRemoteMessageCount("UNSEEN NOT DELETED"); } ImapFolder(ImapStore store, String id); ImapFolder(ImapStore store, String id, FolderNameCodec folderNameCodec); @Override void open(int mode); @Overr...
ImapFolder extends Folder<ImapMessage> { @Override public int getUnreadMessageCount() throws MessagingException { return getRemoteMessageCount("UNSEEN NOT DELETED"); } ImapFolder(ImapStore store, String id); ImapFolder(ImapStore store, String id, FolderNameCodec folderNameCodec); @Override void open(int mode); @Overr...
@Test public void getUnreadMessageCount() throws Exception { ImapFolder folder = createFolder("Folder"); prepareImapFolderForOpen(OPEN_MODE_RW); List<ImapResponse> imapResponses = singletonList(createImapResponse("* SEARCH 1 2 3")); when(imapConnection.executeSimpleCommand("SEARCH 1:* UNSEEN NOT DELETED")).thenReturn(i...
@Override public int getUnreadMessageCount() throws MessagingException { return getRemoteMessageCount("UNSEEN NOT DELETED"); }
ImapFolder extends Folder<ImapMessage> { @Override public int getUnreadMessageCount() throws MessagingException { return getRemoteMessageCount("UNSEEN NOT DELETED"); } }
ImapFolder extends Folder<ImapMessage> { @Override public int getUnreadMessageCount() throws MessagingException { return getRemoteMessageCount("UNSEEN NOT DELETED"); } ImapFolder(ImapStore store, String id); ImapFolder(ImapStore store, String id, FolderNameCodec folderNameCodec); }
ImapFolder extends Folder<ImapMessage> { @Override public int getUnreadMessageCount() throws MessagingException { return getRemoteMessageCount("UNSEEN NOT DELETED"); } ImapFolder(ImapStore store, String id); ImapFolder(ImapStore store, String id, FolderNameCodec folderNameCodec); @Override void open(int mode); @Overr...
ImapFolder extends Folder<ImapMessage> { @Override public int getUnreadMessageCount() throws MessagingException { return getRemoteMessageCount("UNSEEN NOT DELETED"); } ImapFolder(ImapStore store, String id); ImapFolder(ImapStore store, String id, FolderNameCodec folderNameCodec); @Override void open(int mode); @Overr...
@Test public void getFlaggedMessageCount_withClosedFolder_shouldThrow() throws Exception { ImapFolder folder = createFolder("Folder"); when(imapStore.getConnection()).thenReturn(imapConnection); try { folder.getFlaggedMessageCount(); fail("Expected exception"); } catch (MessagingException e) { assertCheckOpenErrorMessa...
@Override public int getFlaggedMessageCount() throws MessagingException { return getRemoteMessageCount("FLAGGED NOT DELETED"); }
ImapFolder extends Folder<ImapMessage> { @Override public int getFlaggedMessageCount() throws MessagingException { return getRemoteMessageCount("FLAGGED NOT DELETED"); } }
ImapFolder extends Folder<ImapMessage> { @Override public int getFlaggedMessageCount() throws MessagingException { return getRemoteMessageCount("FLAGGED NOT DELETED"); } ImapFolder(ImapStore store, String id); ImapFolder(ImapStore store, String id, FolderNameCodec folderNameCodec); }
ImapFolder extends Folder<ImapMessage> { @Override public int getFlaggedMessageCount() throws MessagingException { return getRemoteMessageCount("FLAGGED NOT DELETED"); } ImapFolder(ImapStore store, String id); ImapFolder(ImapStore store, String id, FolderNameCodec folderNameCodec); @Override void open(int mode); @Ove...
ImapFolder extends Folder<ImapMessage> { @Override public int getFlaggedMessageCount() throws MessagingException { return getRemoteMessageCount("FLAGGED NOT DELETED"); } ImapFolder(ImapStore store, String id); ImapFolder(ImapStore store, String id, FolderNameCodec folderNameCodec); @Override void open(int mode); @Ove...
@Test public void doubleEqualsIgnoredAsHR() { String text = "==\n"; String result = HtmlConverter.textToHtml(text); assertEquals("<pre class=\"k9mail\">==<br /></pre>", result); }
public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesThisLine = 0; for ...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
@Test public void getFlaggedMessageCount() throws Exception { ImapFolder folder = createFolder("Folder"); prepareImapFolderForOpen(OPEN_MODE_RW); List<ImapResponse> imapResponses = asList( createImapResponse("* SEARCH 1 2"), createImapResponse("* SEARCH 23 42") ); when(imapConnection.executeSimpleCommand("SEARCH 1:* FL...
@Override public int getFlaggedMessageCount() throws MessagingException { return getRemoteMessageCount("FLAGGED NOT DELETED"); }
ImapFolder extends Folder<ImapMessage> { @Override public int getFlaggedMessageCount() throws MessagingException { return getRemoteMessageCount("FLAGGED NOT DELETED"); } }
ImapFolder extends Folder<ImapMessage> { @Override public int getFlaggedMessageCount() throws MessagingException { return getRemoteMessageCount("FLAGGED NOT DELETED"); } ImapFolder(ImapStore store, String id); ImapFolder(ImapStore store, String id, FolderNameCodec folderNameCodec); }
ImapFolder extends Folder<ImapMessage> { @Override public int getFlaggedMessageCount() throws MessagingException { return getRemoteMessageCount("FLAGGED NOT DELETED"); } ImapFolder(ImapStore store, String id); ImapFolder(ImapStore store, String id, FolderNameCodec folderNameCodec); @Override void open(int mode); @Ove...
ImapFolder extends Folder<ImapMessage> { @Override public int getFlaggedMessageCount() throws MessagingException { return getRemoteMessageCount("FLAGGED NOT DELETED"); } ImapFolder(ImapStore store, String id); ImapFolder(ImapStore store, String id, FolderNameCodec folderNameCodec); @Override void open(int mode); @Ove...
@Test public void getHighestUid() throws Exception { ImapFolder folder = createFolder("Folder"); prepareImapFolderForOpen(OPEN_MODE_RW); List<ImapResponse> imapResponses = singletonList(createImapResponse("* SEARCH 42")); when(imapConnection.executeSimpleCommand("UID SEARCH *:*")).thenReturn(imapResponses); folder.open...
protected long getHighestUid() throws MessagingException { try { String command = "UID SEARCH *:*"; List<ImapResponse> responses = executeSimpleCommand(command); SearchResponse searchResponse = SearchResponse.parse(responses); return extractHighestUid(searchResponse); } catch (NegativeImapResponseException e) { return ...
ImapFolder extends Folder<ImapMessage> { protected long getHighestUid() throws MessagingException { try { String command = "UID SEARCH *:*"; List<ImapResponse> responses = executeSimpleCommand(command); SearchResponse searchResponse = SearchResponse.parse(responses); return extractHighestUid(searchResponse); } catch (N...
ImapFolder extends Folder<ImapMessage> { protected long getHighestUid() throws MessagingException { try { String command = "UID SEARCH *:*"; List<ImapResponse> responses = executeSimpleCommand(command); SearchResponse searchResponse = SearchResponse.parse(responses); return extractHighestUid(searchResponse); } catch (N...
ImapFolder extends Folder<ImapMessage> { protected long getHighestUid() throws MessagingException { try { String command = "UID SEARCH *:*"; List<ImapResponse> responses = executeSimpleCommand(command); SearchResponse searchResponse = SearchResponse.parse(responses); return extractHighestUid(searchResponse); } catch (N...
ImapFolder extends Folder<ImapMessage> { protected long getHighestUid() throws MessagingException { try { String command = "UID SEARCH *:*"; List<ImapResponse> responses = executeSimpleCommand(command); SearchResponse searchResponse = SearchResponse.parse(responses); return extractHighestUid(searchResponse); } catch (N...
@Test public void getMessages_withClosedFolder_shouldThrow() throws Exception { ImapFolder folder = createFolder("Folder"); when(imapStore.getConnection()).thenReturn(imapConnection); try { folder.getMessages(1, 5, null, null); fail("Expected exception"); } catch (MessagingException e) { assertCheckOpenErrorMessage("Fo...
@Override public List<ImapMessage> getMessages(int start, int end, Date earliestDate, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { return getMessages(start, end, earliestDate, false, listener); }
ImapFolder extends Folder<ImapMessage> { @Override public List<ImapMessage> getMessages(int start, int end, Date earliestDate, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { return getMessages(start, end, earliestDate, false, listener); } }
ImapFolder extends Folder<ImapMessage> { @Override public List<ImapMessage> getMessages(int start, int end, Date earliestDate, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { return getMessages(start, end, earliestDate, false, listener); } ImapFolder(ImapStore store, String id); ImapFolder...
ImapFolder extends Folder<ImapMessage> { @Override public List<ImapMessage> getMessages(int start, int end, Date earliestDate, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { return getMessages(start, end, earliestDate, false, listener); } ImapFolder(ImapStore store, String id); ImapFolder...
ImapFolder extends Folder<ImapMessage> { @Override public List<ImapMessage> getMessages(int start, int end, Date earliestDate, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { return getMessages(start, end, earliestDate, false, listener); } ImapFolder(ImapStore store, String id); ImapFolder...
@Test public void getMessages_sequenceNumbers_withClosedFolder_shouldThrow() throws Exception { ImapFolder folder = createFolder("Folder"); when(imapStore.getConnection()).thenReturn(imapConnection); try { folder.getMessages(asList(1L, 2L, 5L), false, null); fail("Expected exception"); } catch (MessagingException e) { ...
@Override public List<ImapMessage> getMessages(int start, int end, Date earliestDate, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { return getMessages(start, end, earliestDate, false, listener); }
ImapFolder extends Folder<ImapMessage> { @Override public List<ImapMessage> getMessages(int start, int end, Date earliestDate, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { return getMessages(start, end, earliestDate, false, listener); } }
ImapFolder extends Folder<ImapMessage> { @Override public List<ImapMessage> getMessages(int start, int end, Date earliestDate, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { return getMessages(start, end, earliestDate, false, listener); } ImapFolder(ImapStore store, String id); ImapFolder...
ImapFolder extends Folder<ImapMessage> { @Override public List<ImapMessage> getMessages(int start, int end, Date earliestDate, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { return getMessages(start, end, earliestDate, false, listener); } ImapFolder(ImapStore store, String id); ImapFolder...
ImapFolder extends Folder<ImapMessage> { @Override public List<ImapMessage> getMessages(int start, int end, Date earliestDate, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { return getMessages(start, end, earliestDate, false, listener); } ImapFolder(ImapStore store, String id); ImapFolder...
@Test public void getMessagesFromUids_withClosedFolder_shouldThrow() throws Exception { ImapFolder folder = createFolder("Folder"); when(imapStore.getConnection()).thenReturn(imapConnection); try { folder.getMessagesFromUids(asList("11", "22", "25")); fail("Expected exception"); } catch (MessagingException e) { assertC...
protected List<ImapMessage> getMessagesFromUids(final List<String> mesgUids) throws MessagingException { ImapSearcher searcher = new ImapSearcher() { @Override public List<ImapResponse> search() throws IOException, MessagingException { String command = String.format("UID SEARCH UID %s", combine(mesgUids.toArray(), ',')...
ImapFolder extends Folder<ImapMessage> { protected List<ImapMessage> getMessagesFromUids(final List<String> mesgUids) throws MessagingException { ImapSearcher searcher = new ImapSearcher() { @Override public List<ImapResponse> search() throws IOException, MessagingException { String command = String.format("UID SEARCH ...
ImapFolder extends Folder<ImapMessage> { protected List<ImapMessage> getMessagesFromUids(final List<String> mesgUids) throws MessagingException { ImapSearcher searcher = new ImapSearcher() { @Override public List<ImapResponse> search() throws IOException, MessagingException { String command = String.format("UID SEARCH ...
ImapFolder extends Folder<ImapMessage> { protected List<ImapMessage> getMessagesFromUids(final List<String> mesgUids) throws MessagingException { ImapSearcher searcher = new ImapSearcher() { @Override public List<ImapResponse> search() throws IOException, MessagingException { String command = String.format("UID SEARCH ...
ImapFolder extends Folder<ImapMessage> { protected List<ImapMessage> getMessagesFromUids(final List<String> mesgUids) throws MessagingException { ImapSearcher searcher = new ImapSearcher() { @Override public List<ImapResponse> search() throws IOException, MessagingException { String command = String.format("UID SEARCH ...
@Test public void getMessagesFromUids() throws Exception { ImapFolder folder = createFolder("Folder"); prepareImapFolderForOpen(OPEN_MODE_RW); List<ImapResponse> imapResponses = asList( createImapResponse("* SEARCH 11"), createImapResponse("* SEARCH 22"), createImapResponse("* SEARCH 25") ); when(imapConnection.execute...
protected List<ImapMessage> getMessagesFromUids(final List<String> mesgUids) throws MessagingException { ImapSearcher searcher = new ImapSearcher() { @Override public List<ImapResponse> search() throws IOException, MessagingException { String command = String.format("UID SEARCH UID %s", combine(mesgUids.toArray(), ',')...
ImapFolder extends Folder<ImapMessage> { protected List<ImapMessage> getMessagesFromUids(final List<String> mesgUids) throws MessagingException { ImapSearcher searcher = new ImapSearcher() { @Override public List<ImapResponse> search() throws IOException, MessagingException { String command = String.format("UID SEARCH ...
ImapFolder extends Folder<ImapMessage> { protected List<ImapMessage> getMessagesFromUids(final List<String> mesgUids) throws MessagingException { ImapSearcher searcher = new ImapSearcher() { @Override public List<ImapResponse> search() throws IOException, MessagingException { String command = String.format("UID SEARCH ...
ImapFolder extends Folder<ImapMessage> { protected List<ImapMessage> getMessagesFromUids(final List<String> mesgUids) throws MessagingException { ImapSearcher searcher = new ImapSearcher() { @Override public List<ImapResponse> search() throws IOException, MessagingException { String command = String.format("UID SEARCH ...
ImapFolder extends Folder<ImapMessage> { protected List<ImapMessage> getMessagesFromUids(final List<String> mesgUids) throws MessagingException { ImapSearcher searcher = new ImapSearcher() { @Override public List<ImapResponse> search() throws IOException, MessagingException { String command = String.format("UID SEARCH ...
@Test public void areMoreMessagesAvailable_withClosedFolder_shouldThrow() throws Exception { ImapFolder folder = createFolder("Folder"); when(imapStore.getConnection()).thenReturn(imapConnection); try { folder.areMoreMessagesAvailable(10, new Date()); fail("Expected exception"); } catch (MessagingException e) { assertC...
@Override public boolean areMoreMessagesAvailable(int indexOfOldestMessage, Date earliestDate) throws IOException, MessagingException { checkOpen(); if (indexOfOldestMessage == 1) { return false; } String dateSearchString = getDateSearchString(earliestDate); int endIndex = indexOfOldestMessage - 1; while (endIndex > 0)...
ImapFolder extends Folder<ImapMessage> { @Override public boolean areMoreMessagesAvailable(int indexOfOldestMessage, Date earliestDate) throws IOException, MessagingException { checkOpen(); if (indexOfOldestMessage == 1) { return false; } String dateSearchString = getDateSearchString(earliestDate); int endIndex = index...
ImapFolder extends Folder<ImapMessage> { @Override public boolean areMoreMessagesAvailable(int indexOfOldestMessage, Date earliestDate) throws IOException, MessagingException { checkOpen(); if (indexOfOldestMessage == 1) { return false; } String dateSearchString = getDateSearchString(earliestDate); int endIndex = index...
ImapFolder extends Folder<ImapMessage> { @Override public boolean areMoreMessagesAvailable(int indexOfOldestMessage, Date earliestDate) throws IOException, MessagingException { checkOpen(); if (indexOfOldestMessage == 1) { return false; } String dateSearchString = getDateSearchString(earliestDate); int endIndex = index...
ImapFolder extends Folder<ImapMessage> { @Override public boolean areMoreMessagesAvailable(int indexOfOldestMessage, Date earliestDate) throws IOException, MessagingException { checkOpen(); if (indexOfOldestMessage == 1) { return false; } String dateSearchString = getDateSearchString(earliestDate); int endIndex = index...
@Test public void fetch_withNullMessageListArgument_shouldDoNothing() throws Exception { ImapFolder folder = createFolder("Folder"); FetchProfile fetchProfile = createFetchProfile(); folder.fetch(null, fetchProfile, null); verifyNoMoreInteractions(imapConnection); }
@Override public void fetch(List<ImapMessage> messages, FetchProfile fetchProfile, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { if (messages == null || messages.isEmpty()) { return; } checkOpen(); List<String> uids = new ArrayList<>(messages.size()); HashMap<String, Message> messageMap = ...
ImapFolder extends Folder<ImapMessage> { @Override public void fetch(List<ImapMessage> messages, FetchProfile fetchProfile, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { if (messages == null || messages.isEmpty()) { return; } checkOpen(); List<String> uids = new ArrayList<>(messages.size()...
ImapFolder extends Folder<ImapMessage> { @Override public void fetch(List<ImapMessage> messages, FetchProfile fetchProfile, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { if (messages == null || messages.isEmpty()) { return; } checkOpen(); List<String> uids = new ArrayList<>(messages.size()...
ImapFolder extends Folder<ImapMessage> { @Override public void fetch(List<ImapMessage> messages, FetchProfile fetchProfile, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { if (messages == null || messages.isEmpty()) { return; } checkOpen(); List<String> uids = new ArrayList<>(messages.size()...
ImapFolder extends Folder<ImapMessage> { @Override public void fetch(List<ImapMessage> messages, FetchProfile fetchProfile, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { if (messages == null || messages.isEmpty()) { return; } checkOpen(); List<String> uids = new ArrayList<>(messages.size()...
@Test public void fetch_withEmptyMessageListArgument_shouldDoNothing() throws Exception { ImapFolder folder = createFolder("Folder"); FetchProfile fetchProfile = createFetchProfile(); folder.fetch(Collections.<ImapMessage>emptyList(), fetchProfile, null); verifyNoMoreInteractions(imapConnection); }
@Override public void fetch(List<ImapMessage> messages, FetchProfile fetchProfile, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { if (messages == null || messages.isEmpty()) { return; } checkOpen(); List<String> uids = new ArrayList<>(messages.size()); HashMap<String, Message> messageMap = ...
ImapFolder extends Folder<ImapMessage> { @Override public void fetch(List<ImapMessage> messages, FetchProfile fetchProfile, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { if (messages == null || messages.isEmpty()) { return; } checkOpen(); List<String> uids = new ArrayList<>(messages.size()...
ImapFolder extends Folder<ImapMessage> { @Override public void fetch(List<ImapMessage> messages, FetchProfile fetchProfile, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { if (messages == null || messages.isEmpty()) { return; } checkOpen(); List<String> uids = new ArrayList<>(messages.size()...
ImapFolder extends Folder<ImapMessage> { @Override public void fetch(List<ImapMessage> messages, FetchProfile fetchProfile, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { if (messages == null || messages.isEmpty()) { return; } checkOpen(); List<String> uids = new ArrayList<>(messages.size()...
ImapFolder extends Folder<ImapMessage> { @Override public void fetch(List<ImapMessage> messages, FetchProfile fetchProfile, MessageRetrievalListener<ImapMessage> listener) throws MessagingException { if (messages == null || messages.isEmpty()) { return; } checkOpen(); List<String> uids = new ArrayList<>(messages.size()...
@Test public void getUidFromMessageId_withoutMessageIdHeader_shouldReturnNull() throws Exception { ImapFolder folder = createFolder("Folder"); ImapMessage message = createImapMessage("2"); when(message.getHeader("Message-ID")).thenReturn(new String[0]); String uid = folder.getUidFromMessageId(message); assertNull(uid);...
@Override public String getUidFromMessageId(Message message) throws MessagingException { try { String[] messageIdHeader = message.getHeader("Message-ID"); if (messageIdHeader.length == 0) { if (K9MailLib.isDebug()) { Timber.d("Did not get a message-id in order to search for UID for %s", getLogId()); } return null; } St...
ImapFolder extends Folder<ImapMessage> { @Override public String getUidFromMessageId(Message message) throws MessagingException { try { String[] messageIdHeader = message.getHeader("Message-ID"); if (messageIdHeader.length == 0) { if (K9MailLib.isDebug()) { Timber.d("Did not get a message-id in order to search for UID ...
ImapFolder extends Folder<ImapMessage> { @Override public String getUidFromMessageId(Message message) throws MessagingException { try { String[] messageIdHeader = message.getHeader("Message-ID"); if (messageIdHeader.length == 0) { if (K9MailLib.isDebug()) { Timber.d("Did not get a message-id in order to search for UID ...
ImapFolder extends Folder<ImapMessage> { @Override public String getUidFromMessageId(Message message) throws MessagingException { try { String[] messageIdHeader = message.getHeader("Message-ID"); if (messageIdHeader.length == 0) { if (K9MailLib.isDebug()) { Timber.d("Did not get a message-id in order to search for UID ...
ImapFolder extends Folder<ImapMessage> { @Override public String getUidFromMessageId(Message message) throws MessagingException { try { String[] messageIdHeader = message.getHeader("Message-ID"); if (messageIdHeader.length == 0) { if (K9MailLib.isDebug()) { Timber.d("Did not get a message-id in order to search for UID ...
@Test public void doubleUnderscoreIgnoredAsHR() { String text = "__\n"; String result = HtmlConverter.textToHtml(text); assertEquals("<pre class=\"k9mail\">__<br /></pre>", result); }
public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesThisLine = 0; for ...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
@Test public void getUidFromMessageId() throws Exception { ImapFolder folder = createFolder("Folder"); prepareImapFolderForOpen(OPEN_MODE_RW); folder.open(OPEN_MODE_RW); ImapMessage message = createImapMessage("2"); when(message.getHeader("Message-ID")).thenReturn(new String[] { "<00000000.0000000@example.org>" }); whe...
@Override public String getUidFromMessageId(Message message) throws MessagingException { try { String[] messageIdHeader = message.getHeader("Message-ID"); if (messageIdHeader.length == 0) { if (K9MailLib.isDebug()) { Timber.d("Did not get a message-id in order to search for UID for %s", getLogId()); } return null; } St...
ImapFolder extends Folder<ImapMessage> { @Override public String getUidFromMessageId(Message message) throws MessagingException { try { String[] messageIdHeader = message.getHeader("Message-ID"); if (messageIdHeader.length == 0) { if (K9MailLib.isDebug()) { Timber.d("Did not get a message-id in order to search for UID ...
ImapFolder extends Folder<ImapMessage> { @Override public String getUidFromMessageId(Message message) throws MessagingException { try { String[] messageIdHeader = message.getHeader("Message-ID"); if (messageIdHeader.length == 0) { if (K9MailLib.isDebug()) { Timber.d("Did not get a message-id in order to search for UID ...
ImapFolder extends Folder<ImapMessage> { @Override public String getUidFromMessageId(Message message) throws MessagingException { try { String[] messageIdHeader = message.getHeader("Message-ID"); if (messageIdHeader.length == 0) { if (K9MailLib.isDebug()) { Timber.d("Did not get a message-id in order to search for UID ...
ImapFolder extends Folder<ImapMessage> { @Override public String getUidFromMessageId(Message message) throws MessagingException { try { String[] messageIdHeader = message.getHeader("Message-ID"); if (messageIdHeader.length == 0) { if (K9MailLib.isDebug()) { Timber.d("Did not get a message-id in order to search for UID ...
@Test public void getNewPushState_withNewerUid_shouldReturnNewPushState() throws Exception { ImapFolder folder = createFolder("Folder"); prepareImapFolderForOpen(OPEN_MODE_RW); ImapMessage message = createImapMessage("2"); String newPushState = folder.getNewPushState("uidNext=2", message); assertEquals("uidNext=3", new...
@Override public String getNewPushState(String oldSerializedPushState, Message message) { try { String uid = message.getUid(); long messageUid = Long.parseLong(uid); ImapPushState oldPushState = ImapPushState.parse(oldSerializedPushState); if (messageUid >= oldPushState.uidNext) { long uidNext = messageUid + 1; ImapPus...
ImapFolder extends Folder<ImapMessage> { @Override public String getNewPushState(String oldSerializedPushState, Message message) { try { String uid = message.getUid(); long messageUid = Long.parseLong(uid); ImapPushState oldPushState = ImapPushState.parse(oldSerializedPushState); if (messageUid >= oldPushState.uidNext)...
ImapFolder extends Folder<ImapMessage> { @Override public String getNewPushState(String oldSerializedPushState, Message message) { try { String uid = message.getUid(); long messageUid = Long.parseLong(uid); ImapPushState oldPushState = ImapPushState.parse(oldSerializedPushState); if (messageUid >= oldPushState.uidNext)...
ImapFolder extends Folder<ImapMessage> { @Override public String getNewPushState(String oldSerializedPushState, Message message) { try { String uid = message.getUid(); long messageUid = Long.parseLong(uid); ImapPushState oldPushState = ImapPushState.parse(oldSerializedPushState); if (messageUid >= oldPushState.uidNext)...
ImapFolder extends Folder<ImapMessage> { @Override public String getNewPushState(String oldSerializedPushState, Message message) { try { String uid = message.getUid(); long messageUid = Long.parseLong(uid); ImapPushState oldPushState = ImapPushState.parse(oldSerializedPushState); if (messageUid >= oldPushState.uidNext)...
@Test public void getNewPushState_withoutNewerUid_shouldReturnNull() throws Exception { ImapFolder folder = createFolder("Folder"); prepareImapFolderForOpen(OPEN_MODE_RW); ImapMessage message = createImapMessage("1"); String newPushState = folder.getNewPushState("uidNext=2", message); assertNull(newPushState); }
@Override public String getNewPushState(String oldSerializedPushState, Message message) { try { String uid = message.getUid(); long messageUid = Long.parseLong(uid); ImapPushState oldPushState = ImapPushState.parse(oldSerializedPushState); if (messageUid >= oldPushState.uidNext) { long uidNext = messageUid + 1; ImapPus...
ImapFolder extends Folder<ImapMessage> { @Override public String getNewPushState(String oldSerializedPushState, Message message) { try { String uid = message.getUid(); long messageUid = Long.parseLong(uid); ImapPushState oldPushState = ImapPushState.parse(oldSerializedPushState); if (messageUid >= oldPushState.uidNext)...
ImapFolder extends Folder<ImapMessage> { @Override public String getNewPushState(String oldSerializedPushState, Message message) { try { String uid = message.getUid(); long messageUid = Long.parseLong(uid); ImapPushState oldPushState = ImapPushState.parse(oldSerializedPushState); if (messageUid >= oldPushState.uidNext)...
ImapFolder extends Folder<ImapMessage> { @Override public String getNewPushState(String oldSerializedPushState, Message message) { try { String uid = message.getUid(); long messageUid = Long.parseLong(uid); ImapPushState oldPushState = ImapPushState.parse(oldSerializedPushState); if (messageUid >= oldPushState.uidNext)...
ImapFolder extends Folder<ImapMessage> { @Override public String getNewPushState(String oldSerializedPushState, Message message) { try { String uid = message.getUid(); long messageUid = Long.parseLong(uid); ImapPushState oldPushState = ImapPushState.parse(oldSerializedPushState); if (messageUid >= oldPushState.uidNext)...
@Test(expected = Error.class) public void delete_notImplemented() throws Exception { ImapFolder folder = createFolder("Folder"); folder.delete(false); }
@Override public void delete(List<? extends Message> messages, String trashFolderName) throws MessagingException { if (messages.isEmpty()) { return; } if (trashFolderName == null || getId().equalsIgnoreCase(trashFolderName)) { setFlags(messages, Collections.singleton(Flag.DELETED), true); } else { ImapFolder remoteTras...
ImapFolder extends Folder<ImapMessage> { @Override public void delete(List<? extends Message> messages, String trashFolderName) throws MessagingException { if (messages.isEmpty()) { return; } if (trashFolderName == null || getId().equalsIgnoreCase(trashFolderName)) { setFlags(messages, Collections.singleton(Flag.DELETE...
ImapFolder extends Folder<ImapMessage> { @Override public void delete(List<? extends Message> messages, String trashFolderName) throws MessagingException { if (messages.isEmpty()) { return; } if (trashFolderName == null || getId().equalsIgnoreCase(trashFolderName)) { setFlags(messages, Collections.singleton(Flag.DELETE...
ImapFolder extends Folder<ImapMessage> { @Override public void delete(List<? extends Message> messages, String trashFolderName) throws MessagingException { if (messages.isEmpty()) { return; } if (trashFolderName == null || getId().equalsIgnoreCase(trashFolderName)) { setFlags(messages, Collections.singleton(Flag.DELETE...
ImapFolder extends Folder<ImapMessage> { @Override public void delete(List<? extends Message> messages, String trashFolderName) throws MessagingException { if (messages.isEmpty()) { return; } if (trashFolderName == null || getId().equalsIgnoreCase(trashFolderName)) { setFlags(messages, Collections.singleton(Flag.DELETE...
@Test public void getMessageByUid_returnsNewImapMessageWithUidInFolder() throws Exception { ImapFolder folder = createFolder("Folder"); ImapMessage message = folder.getMessage("uid"); assertEquals("uid", message.getUid()); assertEquals(folder, message.getFolder()); }
@Override public ImapMessage getMessage(String uid) throws MessagingException { return new ImapMessage(uid, this); }
ImapFolder extends Folder<ImapMessage> { @Override public ImapMessage getMessage(String uid) throws MessagingException { return new ImapMessage(uid, this); } }
ImapFolder extends Folder<ImapMessage> { @Override public ImapMessage getMessage(String uid) throws MessagingException { return new ImapMessage(uid, this); } ImapFolder(ImapStore store, String id); ImapFolder(ImapStore store, String id, FolderNameCodec folderNameCodec); }
ImapFolder extends Folder<ImapMessage> { @Override public ImapMessage getMessage(String uid) throws MessagingException { return new ImapMessage(uid, this); } ImapFolder(ImapStore store, String id); ImapFolder(ImapStore store, String id, FolderNameCodec folderNameCodec); @Override void open(int mode); @Override boolea...
ImapFolder extends Folder<ImapMessage> { @Override public ImapMessage getMessage(String uid) throws MessagingException { return new ImapMessage(uid, this); } ImapFolder(ImapStore store, String id); ImapFolder(ImapStore store, String id, FolderNameCodec folderNameCodec); @Override void open(int mode); @Override boolea...
@Test public void generateBoundary_allZeros() throws Exception { Random random = createRandom(0); BoundaryGenerator boundaryGenerator = new BoundaryGenerator(random); String result = boundaryGenerator.generateBoundary(); assertEquals("----000000000000000000000000000000", result); }
public String generateBoundary() { StringBuilder builder = new StringBuilder(4 + BOUNDARY_CHARACTER_COUNT); builder.append("----"); for (int i = 0; i < BOUNDARY_CHARACTER_COUNT; i++) { builder.append(BASE36_MAP[random.nextInt(36)]); } return builder.toString(); }
BoundaryGenerator { public String generateBoundary() { StringBuilder builder = new StringBuilder(4 + BOUNDARY_CHARACTER_COUNT); builder.append("----"); for (int i = 0; i < BOUNDARY_CHARACTER_COUNT; i++) { builder.append(BASE36_MAP[random.nextInt(36)]); } return builder.toString(); } }
BoundaryGenerator { public String generateBoundary() { StringBuilder builder = new StringBuilder(4 + BOUNDARY_CHARACTER_COUNT); builder.append("----"); for (int i = 0; i < BOUNDARY_CHARACTER_COUNT; i++) { builder.append(BASE36_MAP[random.nextInt(36)]); } return builder.toString(); } @VisibleForTesting BoundaryGenerato...
BoundaryGenerator { public String generateBoundary() { StringBuilder builder = new StringBuilder(4 + BOUNDARY_CHARACTER_COUNT); builder.append("----"); for (int i = 0; i < BOUNDARY_CHARACTER_COUNT; i++) { builder.append(BASE36_MAP[random.nextInt(36)]); } return builder.toString(); } @VisibleForTesting BoundaryGenerato...
BoundaryGenerator { public String generateBoundary() { StringBuilder builder = new StringBuilder(4 + BOUNDARY_CHARACTER_COUNT); builder.append("----"); for (int i = 0; i < BOUNDARY_CHARACTER_COUNT; i++) { builder.append(BASE36_MAP[random.nextInt(36)]); } return builder.toString(); } @VisibleForTesting BoundaryGenerato...
@Test public void generateBoundary() throws Exception { Random random = createRandom(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 35); BoundaryGenerator boundaryGenerator = new BoundaryGenerator(random); String result = boundaryGenerator.generateBoundary(); a...
public String generateBoundary() { StringBuilder builder = new StringBuilder(4 + BOUNDARY_CHARACTER_COUNT); builder.append("----"); for (int i = 0; i < BOUNDARY_CHARACTER_COUNT; i++) { builder.append(BASE36_MAP[random.nextInt(36)]); } return builder.toString(); }
BoundaryGenerator { public String generateBoundary() { StringBuilder builder = new StringBuilder(4 + BOUNDARY_CHARACTER_COUNT); builder.append("----"); for (int i = 0; i < BOUNDARY_CHARACTER_COUNT; i++) { builder.append(BASE36_MAP[random.nextInt(36)]); } return builder.toString(); } }
BoundaryGenerator { public String generateBoundary() { StringBuilder builder = new StringBuilder(4 + BOUNDARY_CHARACTER_COUNT); builder.append("----"); for (int i = 0; i < BOUNDARY_CHARACTER_COUNT; i++) { builder.append(BASE36_MAP[random.nextInt(36)]); } return builder.toString(); } @VisibleForTesting BoundaryGenerato...
BoundaryGenerator { public String generateBoundary() { StringBuilder builder = new StringBuilder(4 + BOUNDARY_CHARACTER_COUNT); builder.append("----"); for (int i = 0; i < BOUNDARY_CHARACTER_COUNT; i++) { builder.append(BASE36_MAP[random.nextInt(36)]); } return builder.toString(); } @VisibleForTesting BoundaryGenerato...
BoundaryGenerator { public String generateBoundary() { StringBuilder builder = new StringBuilder(4 + BOUNDARY_CHARACTER_COUNT); builder.append("----"); for (int i = 0; i < BOUNDARY_CHARACTER_COUNT; i++) { builder.append(BASE36_MAP[random.nextInt(36)]); } return builder.toString(); } @VisibleForTesting BoundaryGenerato...
@Test public void equals_whenFolderIdDifferent_isFalse() { SimpleFolder folder1 = new SimpleFolder(); folder1.id = "1"; SimpleFolder folder2 = new SimpleFolder(); folder2.id = "2"; String uid = "uid"; Message m1 = new StoredMimeMessage(folder1, uid); Message m2 = new StoredMimeMessage(folder2, uid); boolean result = m1...
@Override public boolean equals(Object o) { if (o == null || !(o instanceof Message)) { return false; } Message other = (Message)o; return (getUid().equals(other.getUid()) && getFolder().getId().equals(other.getFolder().getId())); }
Message implements Part, Body { @Override public boolean equals(Object o) { if (o == null || !(o instanceof Message)) { return false; } Message other = (Message)o; return (getUid().equals(other.getUid()) && getFolder().getId().equals(other.getFolder().getId())); } }
Message implements Part, Body { @Override public boolean equals(Object o) { if (o == null || !(o instanceof Message)) { return false; } Message other = (Message)o; return (getUid().equals(other.getUid()) && getFolder().getId().equals(other.getFolder().getId())); } }
Message implements Part, Body { @Override public boolean equals(Object o) { if (o == null || !(o instanceof Message)) { return false; } Message other = (Message)o; return (getUid().equals(other.getUid()) && getFolder().getId().equals(other.getFolder().getId())); } boolean olderThan(Date earliestDate); @Override boolea...
Message implements Part, Body { @Override public boolean equals(Object o) { if (o == null || !(o instanceof Message)) { return false; } Message other = (Message)o; return (getUid().equals(other.getUid()) && getFolder().getId().equals(other.getFolder().getId())); } boolean olderThan(Date earliestDate); @Override boolea...
@Test public void equals_whenUidDifferent_isFalse() { SimpleFolder folder = new SimpleFolder(); folder.id = "1"; String uid1 = "uid1"; String uid2 = "uid2"; Message m1 = new StoredMimeMessage(folder, uid1); Message m2 = new StoredMimeMessage(folder, uid2); boolean result = m1.equals(m2); assertFalse(result); }
@Override public boolean equals(Object o) { if (o == null || !(o instanceof Message)) { return false; } Message other = (Message)o; return (getUid().equals(other.getUid()) && getFolder().getId().equals(other.getFolder().getId())); }
Message implements Part, Body { @Override public boolean equals(Object o) { if (o == null || !(o instanceof Message)) { return false; } Message other = (Message)o; return (getUid().equals(other.getUid()) && getFolder().getId().equals(other.getFolder().getId())); } }
Message implements Part, Body { @Override public boolean equals(Object o) { if (o == null || !(o instanceof Message)) { return false; } Message other = (Message)o; return (getUid().equals(other.getUid()) && getFolder().getId().equals(other.getFolder().getId())); } }
Message implements Part, Body { @Override public boolean equals(Object o) { if (o == null || !(o instanceof Message)) { return false; } Message other = (Message)o; return (getUid().equals(other.getUid()) && getFolder().getId().equals(other.getFolder().getId())); } boolean olderThan(Date earliestDate); @Override boolea...
Message implements Part, Body { @Override public boolean equals(Object o) { if (o == null || !(o instanceof Message)) { return false; } Message other = (Message)o; return (getUid().equals(other.getUid()) && getFolder().getId().equals(other.getFolder().getId())); } boolean olderThan(Date earliestDate); @Override boolea...
@Test public void equals_whenUidAndFolderSame_isTrue() { SimpleFolder folder1 = new SimpleFolder(); folder1.id = "1"; SimpleFolder folder2 = new SimpleFolder(); folder2.id = "1"; String uid = "uid"; Message m1 = new StoredMimeMessage(folder1, uid); Message m2 = new StoredMimeMessage(folder2, uid); boolean result = m1.e...
@Override public boolean equals(Object o) { if (o == null || !(o instanceof Message)) { return false; } Message other = (Message)o; return (getUid().equals(other.getUid()) && getFolder().getId().equals(other.getFolder().getId())); }
Message implements Part, Body { @Override public boolean equals(Object o) { if (o == null || !(o instanceof Message)) { return false; } Message other = (Message)o; return (getUid().equals(other.getUid()) && getFolder().getId().equals(other.getFolder().getId())); } }
Message implements Part, Body { @Override public boolean equals(Object o) { if (o == null || !(o instanceof Message)) { return false; } Message other = (Message)o; return (getUid().equals(other.getUid()) && getFolder().getId().equals(other.getFolder().getId())); } }
Message implements Part, Body { @Override public boolean equals(Object o) { if (o == null || !(o instanceof Message)) { return false; } Message other = (Message)o; return (getUid().equals(other.getUid()) && getFolder().getId().equals(other.getFolder().getId())); } boolean olderThan(Date earliestDate); @Override boolea...
Message implements Part, Body { @Override public boolean equals(Object o) { if (o == null || !(o instanceof Message)) { return false; } Message other = (Message)o; return (getUid().equals(other.getUid()) && getFolder().getId().equals(other.getFolder().getId())); } boolean olderThan(Date earliestDate); @Override boolea...
@Test public void anyTripletIsHRuledOut() { String text = "--=\n-=-\n===\n___\n\n"; String result = HtmlConverter.textToHtml(text); assertEquals("<pre class=\"k9mail\"><hr></pre>", result); }
public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesThisLine = 0; for ...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
@Test public void findEncryptedPartsShouldReturnEmptyListForSimpleMessage() throws Exception { MimeMessage message = new MimeMessage(); message.setBody(new TextBody("message text")); List<Part> encryptedParts = MessageDecryptVerifier.findEncryptedParts(message); assertEquals(0, encryptedParts.size()); }
public static List<Part> findEncryptedParts(Part startPart) { List<Part> encryptedParts = new ArrayList<>(); Stack<Part> partsToCheck = new Stack<>(); partsToCheck.push(startPart); while (!partsToCheck.isEmpty()) { Part part = partsToCheck.pop(); Body body = part.getBody(); if (isPartMultipartEncrypted(part)) { encrypt...
MessageDecryptVerifier { public static List<Part> findEncryptedParts(Part startPart) { List<Part> encryptedParts = new ArrayList<>(); Stack<Part> partsToCheck = new Stack<>(); partsToCheck.push(startPart); while (!partsToCheck.isEmpty()) { Part part = partsToCheck.pop(); Body body = part.getBody(); if (isPartMultipartE...
MessageDecryptVerifier { public static List<Part> findEncryptedParts(Part startPart) { List<Part> encryptedParts = new ArrayList<>(); Stack<Part> partsToCheck = new Stack<>(); partsToCheck.push(startPart); while (!partsToCheck.isEmpty()) { Part part = partsToCheck.pop(); Body body = part.getBody(); if (isPartMultipartE...
MessageDecryptVerifier { public static List<Part> findEncryptedParts(Part startPart) { List<Part> encryptedParts = new ArrayList<>(); Stack<Part> partsToCheck = new Stack<>(); partsToCheck.push(startPart); while (!partsToCheck.isEmpty()) { Part part = partsToCheck.pop(); Body body = part.getBody(); if (isPartMultipartE...
MessageDecryptVerifier { public static List<Part> findEncryptedParts(Part startPart) { List<Part> encryptedParts = new ArrayList<>(); Stack<Part> partsToCheck = new Stack<>(); partsToCheck.push(startPart); while (!partsToCheck.isEmpty()) { Part part = partsToCheck.pop(); Body body = part.getBody(); if (isPartMultipartE...
@Test public void replaceSpaceSeparatedDashesWithHR() { String text = "hello\n---------------------------\nfoo bar"; String result = HtmlConverter.textToHtml(text); assertEquals("<pre class=\"k9mail\">hello<hr>foo bar</pre>", result); }
public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesThisLine = 0; for ...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
@Test public void replacementWithHRAtBeginning() { String text = "---------------------------\nfoo bar"; String result = HtmlConverter.textToHtml(text); assertEquals("<pre class=\"k9mail\"><hr>foo bar</pre>", result); }
public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesThisLine = 0; for ...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
@Test public void replacementWithHRAtEnd() { String text = "hello\n__________________________________"; String result = HtmlConverter.textToHtml(text); assertEquals("<pre class=\"k9mail\">hello<hr></pre>", result); }
public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesThisLine = 0; for ...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
@Test public void replacementOfScissorsByHR() { String text = "hello\n-- %< -------------- >8 --\nworld\n"; String result = HtmlConverter.textToHtml(text); assertEquals("<pre class=\"k9mail\">hello<hr>world<br /></pre>", result); }
public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesThisLine = 0; for ...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
HtmlConverter { public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesTh...
@Test public void domainWithTrailingSpace() { String text = "http: int endPos = parser.linkifyUri(text, 0, outputBuffer); assertLinkOnly("http: assertEquals(text.length() - 1, endPos); }
@Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.length())); if (longScheme.equalsIgnor...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
@Test public void domainWithTrailingNewline() { String text = "http: int endPos = parser.linkifyUri(text, 0, outputBuffer); assertLinkOnly("http: assertEquals(text.length() - 1, endPos); }
@Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.length())); if (longScheme.equalsIgnor...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
@Test public void domainWithTrailingAngleBracket() { String text = "<http: int endPos = parser.linkifyUri(text, 1, outputBuffer); assertLinkOnly("http: assertEquals(text.length() - 1, endPos); }
@Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.length())); if (longScheme.equalsIgnor...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
@Test public void uriInMiddleAfterInput() { String prefix = "prefix "; String uri = "http: String text = prefix + uri; parser.linkifyUri(text, prefix.length(), outputBuffer); assertLinkOnly(uri, outputBuffer); }
@Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.length())); if (longScheme.equalsIgnor...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
@Test public void uriInMiddleOfInput() { String prefix = "prefix "; String uri = "http: String postfix = " postfix"; String text = prefix + uri + postfix; parser.linkifyUri(text, prefix.length(), outputBuffer); assertLinkOnly(uri, outputBuffer); }
@Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.length())); if (longScheme.equalsIgnor...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
HttpUriParser implements UriParser { @Override public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { int currentPos = startPos; String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length())); String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.l...
@Test public void shouldRemoveMetaRefreshInHead() { String html = "<html>" + "<head><meta http-equiv=\"refresh\" content=\"1; URL=http: "<body>Message</body>" + "</html>"; Document result = htmlSanitizer.sanitize(html); assertEquals("<html><head></head><body>Message</body></html>", toCompactString(result)); }
public Document sanitize(String html) { Document dirtyDocument = Jsoup.parse(html); Document cleanedDocument = cleaner.clean(dirtyDocument); headCleaner.clean(dirtyDocument, cleanedDocument); return cleanedDocument; }
HtmlSanitizer { public Document sanitize(String html) { Document dirtyDocument = Jsoup.parse(html); Document cleanedDocument = cleaner.clean(dirtyDocument); headCleaner.clean(dirtyDocument, cleanedDocument); return cleanedDocument; } }
HtmlSanitizer { public Document sanitize(String html) { Document dirtyDocument = Jsoup.parse(html); Document cleanedDocument = cleaner.clean(dirtyDocument); headCleaner.clean(dirtyDocument, cleanedDocument); return cleanedDocument; } HtmlSanitizer(); }
HtmlSanitizer { public Document sanitize(String html) { Document dirtyDocument = Jsoup.parse(html); Document cleanedDocument = cleaner.clean(dirtyDocument); headCleaner.clean(dirtyDocument, cleanedDocument); return cleanedDocument; } HtmlSanitizer(); Document sanitize(String html); }
HtmlSanitizer { public Document sanitize(String html) { Document dirtyDocument = Jsoup.parse(html); Document cleanedDocument = cleaner.clean(dirtyDocument); headCleaner.clean(dirtyDocument, cleanedDocument); return cleanedDocument; } HtmlSanitizer(); Document sanitize(String html); }
@Test public void findEncryptedPartsShouldReturnEmptyEncryptedPart() throws Exception { MimeMessage message = new MimeMessage(); MimeMultipart multipartEncrypted = MimeMultipart.newInstance(); multipartEncrypted.setSubType("encrypted"); MimeMessageHelper.setBody(message, multipartEncrypted); setContentTypeWithProtocol(...
public static List<Part> findEncryptedParts(Part startPart) { List<Part> encryptedParts = new ArrayList<>(); Stack<Part> partsToCheck = new Stack<>(); partsToCheck.push(startPart); while (!partsToCheck.isEmpty()) { Part part = partsToCheck.pop(); Body body = part.getBody(); if (isPartMultipartEncrypted(part)) { encrypt...
MessageDecryptVerifier { public static List<Part> findEncryptedParts(Part startPart) { List<Part> encryptedParts = new ArrayList<>(); Stack<Part> partsToCheck = new Stack<>(); partsToCheck.push(startPart); while (!partsToCheck.isEmpty()) { Part part = partsToCheck.pop(); Body body = part.getBody(); if (isPartMultipartE...
MessageDecryptVerifier { public static List<Part> findEncryptedParts(Part startPart) { List<Part> encryptedParts = new ArrayList<>(); Stack<Part> partsToCheck = new Stack<>(); partsToCheck.push(startPart); while (!partsToCheck.isEmpty()) { Part part = partsToCheck.pop(); Body body = part.getBody(); if (isPartMultipartE...
MessageDecryptVerifier { public static List<Part> findEncryptedParts(Part startPart) { List<Part> encryptedParts = new ArrayList<>(); Stack<Part> partsToCheck = new Stack<>(); partsToCheck.push(startPart); while (!partsToCheck.isEmpty()) { Part part = partsToCheck.pop(); Body body = part.getBody(); if (isPartMultipartE...
MessageDecryptVerifier { public static List<Part> findEncryptedParts(Part startPart) { List<Part> encryptedParts = new ArrayList<>(); Stack<Part> partsToCheck = new Stack<>(); partsToCheck.push(startPart); while (!partsToCheck.isEmpty()) { Part part = partsToCheck.pop(); Body body = part.getBody(); if (isPartMultipartE...
@Test public void TestEmptyStringReturnZero() { Assert.assertEquals(0, stringCalculator.add("")); }
public int add(String input) { if ("".equals(input)) { return 0; } String numbers = extractNumbers(input); String delimiter = extractDelimiter(input); return stringSum(numbers, delimiter); }
StringCalculator { public int add(String input) { if ("".equals(input)) { return 0; } String numbers = extractNumbers(input); String delimiter = extractDelimiter(input); return stringSum(numbers, delimiter); } }
StringCalculator { public int add(String input) { if ("".equals(input)) { return 0; } String numbers = extractNumbers(input); String delimiter = extractDelimiter(input); return stringSum(numbers, delimiter); } }
StringCalculator { public int add(String input) { if ("".equals(input)) { return 0; } String numbers = extractNumbers(input); String delimiter = extractDelimiter(input); return stringSum(numbers, delimiter); } int add(String input); }
StringCalculator { public int add(String input) { if ("".equals(input)) { return 0; } String numbers = extractNumbers(input); String delimiter = extractDelimiter(input); return stringSum(numbers, delimiter); } int add(String input); }
@Test public void comma_or_return_line_separated_numbers_return_sum() { Assert.assertEquals(6, this.calculator.add("1\n2,3")); }
public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } int add(String input); }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } int add(String input); }
@Test public void any_delimited_numbers_return_sum() { Assert.assertEquals(3, this.calculator.add(" }
public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } int add(String input); }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } int add(String input); }
@Test public void negative_number_throw_exception() { this.exception.expect(RuntimeException.class); this.exception.expectMessage("negativos no soportados: -1"); this.calculator.add("-1"); }
public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } int add(String input); }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } int add(String input); }
@Test public void multiple_negative_number_throw_exception() { this.exception.expect(RuntimeException.class); this.exception.expectMessage("negativos no soportados: -1,-2"); this.calculator.add("-1,-2"); }
public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } int add(String input); }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } int add(String input); }
@Test public void numbers_greater_than_thousand_not_sum() { Assert.assertEquals(3, this.calculator.add("1,2,1001")); }
public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } int add(String input); }
StringCalculator { public int add(String input) { if ("".equals(input)) return 0; String delimiter = extractDelimiter(input); String[] numberArray = extractNumbers(input, delimiter); return sumNumberArray(numberArray); } int add(String input); }