You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2017/11/30 02:39:18 UTC
[2/9] james-project git commit: JAMES-2229 Add imap testing when
create mailbox name with only delimiter
JAMES-2229 Add imap testing when create mailbox name with only delimiter
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/fa760c87
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/fa760c87
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/fa760c87
Branch: refs/heads/master
Commit: fa760c8714298c3fb1fff249c0966653fabd4f05
Parents: fd69a44
Author: quynhn <qn...@linagora.com>
Authored: Wed Nov 22 14:58:27 2017 +0700
Committer: benwa <bt...@linagora.com>
Committed: Thu Nov 30 09:34:54 2017 +0700
----------------------------------------------------------------------
.../resources/org/apache/james/imap/scripts/Create.test | 4 ++++
.../imap/decode/parser/CreateCommandParserTest.java | 11 +++++++----
2 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/fa760c87/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Create.test
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Create.test b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Create.test
index 87a49d7..67445f7 100644
--- a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Create.test
+++ b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Create.test
@@ -31,6 +31,10 @@ S: 13 OK CREATE completed.
# Create quoted
C: 14 CREATE "Pepe juan"
S: 14 OK CREATE completed.
+
+C: 15 CREATE ..
+S: 15 BAD CREATE failed. Illegal arguments.
+
#
# RFC3501@6.3.3p2
# When mailbox name is suffixed with hierarchy separator
http://git-wip-us.apache.org/repos/asf/james-project/blob/fa760c87/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/CreateCommandParserTest.java
----------------------------------------------------------------------
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/CreateCommandParserTest.java b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/CreateCommandParserTest.java
index 7f6a4f4..d5d2b6a 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/CreateCommandParserTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/decode/parser/CreateCommandParserTest.java
@@ -20,6 +20,7 @@
package org.apache.james.imap.decode.parser;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -59,20 +60,22 @@ public class CreateCommandParserTest {
parser = new CreateCommandParser();
}
- @Test(expected = DecodingException.class)
+ @Test
public void decodeShouldThrowWhenCommandHasEmptyMailbox() throws DecodingException {
InputStream inputStream = new ByteArrayInputStream(" \n".getBytes(Charsets.US_ASCII));
ImapRequestStreamLineReader lineReader = new ImapRequestStreamLineReader(inputStream, outputStream);
- parser.decode(command, lineReader, TAG, mockImapSession);
+ assertThatThrownBy(() -> parser.decode(command, lineReader, TAG, mockImapSession))
+ .isInstanceOf(DecodingException.class);
}
- @Test(expected = DecodingException.class)
+ @Test
public void decodeShouldThrowWhenCommandHasOnlySeparatorMailbox() throws DecodingException {
InputStream inputStream = new ByteArrayInputStream("..\n".getBytes(Charsets.US_ASCII));
ImapRequestStreamLineReader lineReader = new ImapRequestStreamLineReader(inputStream, outputStream);
- parser.decode(command, lineReader, TAG, mockImapSession);
+ assertThatThrownBy(() -> parser.decode(command, lineReader, TAG, mockImapSession))
+ .isInstanceOf(DecodingException.class);
}
@Test
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org