You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by "mbaechler (via GitHub)" <gi...@apache.org> on 2026/01/08 09:27:50 UTC

[PR] boyscoot: test Authentication parsing [james-project]

mbaechler opened a new pull request, #2906:
URL: https://github.com/apache/james-project/pull/2906

   (no comment)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


Re: [PR] boyscoot: test Authentication parsing [james-project]

Posted by "chibenwa (via GitHub)" <gi...@apache.org>.
chibenwa commented on code in PR #2906:
URL: https://github.com/apache/james-project/pull/2906#discussion_r2671655039


##########
protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandlerTest.java:
##########
@@ -0,0 +1,68 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.protocols.smtp.core.esmtp;
+
+import org.apache.james.core.Username;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.Optional;
+
+class AuthCmdHandlerTest {
+
+    @Test
+    void shouldReturnEmptyWhenEmptyInput() {
+        Assertions.assertThat(AuthCmdHandler.parseAuthValues("")).isEmpty();
+    }
+
+    @Test
+    void shouldReturnEmptyWhenBlankInput() {
+        Assertions.assertThat(AuthCmdHandler.parseAuthValues(" \t\n")).isEmpty();
+    }
+
+    @Test
+    void shouldReturnEmptyWhenTwoBlankParts() {
+        Assertions.assertThat(AuthCmdHandler.parseAuthValues(" \0\t\n")).isEmpty();
+    }
+
+    @Test
+    void shouldReturnEmptyWhenThreeBlankParts() {
+        Assertions.assertThat(AuthCmdHandler.parseAuthValues(" \0\0 ")).isEmpty();
+    }
+
+    @Test
+    void shouldReturnUsernameWhenSinglePart() {
+        Assertions.assertThat(AuthCmdHandler.parseAuthValues("bob"))
+                .contains(new AuthCmdHandler.AuthValues(Username.of("bob"), Optional.empty()));
+    }
+
+    @Test
+    void shouldReturnUsernameAndPassWhenTwoParts() {
+        Assertions.assertThat(AuthCmdHandler.parseAuthValues("bob\0pass"))
+                .contains(new AuthCmdHandler.AuthValues(Username.of("bob"), Optional.of("pass")));
+    }
+
+    @Test
+    void shouldReturnUsernameAndPassWhenThreeParts() {
+        Assertions.assertThat(AuthCmdHandler.parseAuthValues("something\0bob\0pass"))
+                .contains(new AuthCmdHandler.AuthValues(Username.of("bob"), Optional.of("pass")));
+    }
+
+
+}

Review Comment:
   ```suggestion
       }
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


Re: [PR] boyscoot: test Authentication parsing [james-project]

Posted by "Arsnael (via GitHub)" <gi...@apache.org>.
Arsnael commented on code in PR #2906:
URL: https://github.com/apache/james-project/pull/2906#discussion_r2674739958


##########
protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandlerTest.java:
##########
@@ -0,0 +1,68 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.protocols.smtp.core.esmtp;
+
+import org.apache.james.core.Username;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.Optional;
+
+class AuthCmdHandlerTest {
+
+    @Test
+    void shouldReturnEmptyWhenEmptyInput() {
+        Assertions.assertThat(AuthCmdHandler.parseAuthValues("")).isEmpty();
+    }
+
+    @Test
+    void shouldReturnEmptyWhenBlankInput() {
+        Assertions.assertThat(AuthCmdHandler.parseAuthValues(" \t\n")).isEmpty();
+    }
+
+    @Test
+    void shouldReturnEmptyWhenTwoBlankParts() {
+        Assertions.assertThat(AuthCmdHandler.parseAuthValues(" \0\t\n")).isEmpty();
+    }
+
+    @Test
+    void shouldReturnEmptyWhenThreeBlankParts() {
+        Assertions.assertThat(AuthCmdHandler.parseAuthValues(" \0\0 ")).isEmpty();
+    }
+
+    @Test
+    void shouldReturnUsernameWhenSinglePart() {
+        Assertions.assertThat(AuthCmdHandler.parseAuthValues("bob"))
+                .contains(new AuthCmdHandler.AuthValues(Username.of("bob"), Optional.empty()));
+    }
+
+    @Test
+    void shouldReturnUsernameAndPassWhenTwoParts() {
+        Assertions.assertThat(AuthCmdHandler.parseAuthValues("bob\0pass"))
+                .contains(new AuthCmdHandler.AuthValues(Username.of("bob"), Optional.of("pass")));
+    }
+
+    @Test
+    void shouldReturnUsernameAndPassWhenThreeParts() {
+        Assertions.assertThat(AuthCmdHandler.parseAuthValues("something\0bob\0pass"))
+                .contains(new AuthCmdHandler.AuthValues(Username.of("bob"), Optional.of("pass")));
+    }
+
+
+}

Review Comment:
   Not applied?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


Re: [PR] boyscoot: test Authentication parsing [james-project]

Posted by "quantranhong1999 (via GitHub)" <gi...@apache.org>.
quantranhong1999 commented on PR #2906:
URL: https://github.com/apache/james-project/pull/2906#issuecomment-3723109371

   org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.6.0:check (check-style) on project protocols-smtp: You have 1 Checkstyle violation.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


Re: [PR] boyscoot: test Authentication parsing [james-project]

Posted by "chibenwa (via GitHub)" <gi...@apache.org>.
chibenwa merged PR #2906:
URL: https://github.com/apache/james-project/pull/2906


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org