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 <[email protected]>
Authored: Wed Nov 22 14:58:27 2017 +0700
Committer: benwa <[email protected]>
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.
+
 #
 # [email protected]
 # 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to