[
https://issues.apache.org/jira/browse/JAMES-2453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17256981#comment-17256981
]
ASF GitHub Bot commented on JAMES-2453:
---------------------------------------
jeantil commented on a change in pull request #284:
URL: https://github.com/apache/james-project/pull/284#discussion_r550477496
##########
File path:
server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/SpamAssassinTest.java
##########
@@ -30,23 +30,23 @@
import org.apache.james.metrics.tests.RecordingMetricFactory;
import org.apache.james.spamassassin.SpamAssassinResult;
import org.apache.james.spamassassin.mock.MockSpamd;
-import org.apache.james.spamassassin.mock.MockSpamdTestRule;
+import org.apache.james.spamassassin.mock.MockSpamdExtension;
import org.apache.james.user.memory.MemoryUsersRepository;
import org.apache.james.util.Port;
import org.apache.mailet.Mail;
import org.apache.mailet.PerRecipientHeaders;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
import com.github.steveash.guavate.Guavate;
public class SpamAssassinTest {
Review comment:
I noticed this public remained though you removed most others: is it
still needed ?
##########
File path:
server/protocols/jwt/src/test/java/org/apache/james/jwt/JwtConfigurationTest.java
##########
@@ -39,32 +39,32 @@
"-----END PUBLIC KEY-----";
@Test
- public void getJwtPublicKeyPemShouldReturnEmptyWhenEmptyPublicKey() throws
Exception {
+ public void getJwtPublicKeyPemShouldReturnEmptyWhenEmptyPublicKey() {
Review comment:
same here, you removed most public on other classes: but not here ?
##########
File path:
server/protocols/jwt/src/test/java/org/apache/james/jwt/PublicKeyProviderTest.java
##########
@@ -41,7 +41,7 @@
"kwIDAQAB\n" +
"-----END PUBLIC KEY-----";
- @BeforeClass
+ @BeforeAll
Review comment:
one more public :)
##########
File path:
server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SpamAssassinHandlerTest.java
##########
@@ -39,13 +39,13 @@
import org.apache.james.smtpserver.fastfail.SpamAssassinHandler;
import org.apache.james.spamassassin.SpamAssassinResult;
import org.apache.james.spamassassin.mock.MockSpamd;
-import org.apache.james.spamassassin.mock.MockSpamdTestRule;
+import org.apache.james.spamassassin.mock.MockSpamdExtension;
import org.apache.mailet.Attribute;
import org.apache.mailet.AttributeValue;
import org.apache.mailet.Mail;
import org.apache.mailet.base.test.FakeMail;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
Review comment:
probably remove the public modifiers here too
##########
File path:
server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/URIRBLHandlerTest.java
##########
@@ -45,7 +45,7 @@
import org.apache.james.smtpserver.fastfail.URIRBLHandler;
import org.apache.mailet.Mail;
import org.apache.mailet.base.test.FakeMail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
Review comment:
probably remove the public here too
##########
File path:
third-party/spamassassin/src/test/java/org/apache/james/spamassassin/mock/MockSpamdExtension.java
##########
@@ -23,25 +23,29 @@
import java.util.concurrent.Executors;
import org.apache.james.util.concurrent.NamedThreadFactory;
+import org.junit.jupiter.api.extension.AfterEachCallback;
+import org.junit.jupiter.api.extension.BeforeAllCallback;
+import org.junit.jupiter.api.extension.BeforeEachCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.rules.ExternalResource;
-public class MockSpamdTestRule extends ExternalResource {
+public class MockSpamdExtension implements AfterEachCallback,
BeforeEachCallback {
Review comment:
the last of the public modifiers
I know how painful it is to do this, I won't blame you if you don't want to
do it :)
##########
File path:
server/protocols/jwt/src/test/java/org/apache/james/jwt/PublicKeyReaderTest.java
##########
@@ -40,7 +40,7 @@
"kwIDAQAB\n" +
"-----END PUBLIC KEY-----";
- @BeforeClass
+ @BeforeAll
Review comment:
more public :)
##########
File path:
server/protocols/jwt/src/test/java/org/apache/james/jwt/JwtTokenVerifierTest.java
##########
@@ -65,15 +65,12 @@
"bmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.";
private JwtTokenVerifier sut;
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- @BeforeClass
+ @BeforeAll
public static void init() {
Security.addProvider(new BouncyCastleProvider());
}
- @Before
+ @BeforeEach
Review comment:
same remark about public here (on class, init and setup)
##########
File path:
server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
##########
@@ -27,18 +27,13 @@
import org.apache.commons.configuration2.HierarchicalConfiguration;
import org.apache.commons.configuration2.tree.ImmutableNode;
import org.apache.james.imap.api.ImapConfiguration;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.ImmutableSet;
public class IMAPServerTest {
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
@Test
- public void getImapConfigurationShouldReturnDefaultValuesWhenEmpty()
throws Exception {
+ public void getImapConfigurationShouldReturnDefaultValuesWhenEmpty() {
Review comment:
more public
##########
File path:
server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
##########
@@ -73,15 +73,15 @@
private POP3Server pop3Server;
private HashedWheelTimer hashedWheelTimer;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
hashedWheelTimer = new HashedWheelTimer();
setUpServiceManager();
setUpPOP3Server();
pop3Configuration = new POP3TestConfiguration();
}
- @After
+ @AfterEach
Review comment:
the public stuff ...
##########
File path:
server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java
##########
@@ -62,7 +62,7 @@
private MailAddress user1mail;
private MailAddress invalidUserEmail;
- @Before
+ @BeforeEach
Review comment:
probably remove public modifiers here too
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
> How to: Using Embedded James SMTP server in unit tests
> ------------------------------------------------------
>
> Key: JAMES-2453
> URL: https://issues.apache.org/jira/browse/JAMES-2453
> Project: James Server
> Issue Type: Task
> Components: Documentation
> Reporter: Benoit Tellier
> Priority: Major
> Labels: how-to
>
> Write a tutorial on top of
> [https://github.com/linagora/james-project/pull/1493] to explain how to use
> James in unit tests.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]