This is an automated email from the ASF dual-hosted git repository. chibenwa pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 2ea03413ea98e642bb4d641254396113c6f2c8bd Author: Quan Tran <[email protected]> AuthorDate: Thu Jun 4 14:49:13 2026 +0700 [REFACTORING] Split IMAPServerPlainAuthDisallowedTest --- .../netty/IMAPServerPlainAuthDisallowedTest.java | 62 ++++++++++++++++++++++ .../james/imapserver/netty/IMAPServerTest.java | 33 ------------ 2 files changed, 62 insertions(+), 33 deletions(-) diff --git a/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerPlainAuthDisallowedTest.java b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerPlainAuthDisallowedTest.java new file mode 100644 index 0000000000..e8277f937d --- /dev/null +++ b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerPlainAuthDisallowedTest.java @@ -0,0 +1,62 @@ +/**************************************************************** + * 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.imapserver.netty; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + + +@SuppressWarnings("checkstyle:membername") +class IMAPServerPlainAuthDisallowedTest extends AbstractIMAPServerTest { + IMAPServer imapServer; + private int port; + + @BeforeEach + void beforeEach() throws Exception { + imapServer = createImapServer("imapServerPlainAuthDisallowed.xml"); + port = imapServer.getListenAddresses().get(0).getPort(); + } + + @AfterEach + void tearDown() { + imapServer.destroy(); + } + + @Test + void loginShouldFailOnUnEncryptedChannel() { + assertThatThrownBy(() -> + testIMAPClient.connect("127.0.0.1", port) + .login(USER.asString(), USER_PASS)) + .hasMessage("Login failed"); + } + + @Test + void capabilityShouldNotAdvertiseLoginOnUnEncryptedChannel() throws Exception { + testIMAPClient.connect("127.0.0.1", port); + + assertThat(testIMAPClient.capability()) + .contains("LOGINDISABLED") + .doesNotContain("AUTH=PLAIN"); + } +} diff --git a/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java index 46a123313d..8926e4fc9b 100644 --- a/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java +++ b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java @@ -259,39 +259,6 @@ class IMAPServerTest { - @Nested - class PlainAuthDisallowed { - IMAPServer imapServer; - private int port; - - @BeforeEach - void beforeEach() throws Exception { - imapServer = createImapServer("imapServerPlainAuthDisallowed.xml"); - port = imapServer.getListenAddresses().get(0).getPort(); - } - - @AfterEach - void tearDown() { - imapServer.destroy(); - } - - @Test - void loginShouldFailOnUnEncryptedChannel() { - assertThatThrownBy(() -> - testIMAPClient.connect("127.0.0.1", port) - .login(USER.asString(), USER_PASS)) - .hasMessage("Login failed"); - } - - @Test - void capabilityShouldNotAdvertiseLoginOnUnEncryptedChannel() throws Exception { - testIMAPClient.connect("127.0.0.1", port); - - assertThat(testIMAPClient.capability()) - .contains("LOGINDISABLED") - .doesNotContain("AUTH=PLAIN"); - } - } @Nested class PlainAuthDisallowedSSL { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
