You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by GitBox <gi...@apache.org> on 2020/12/31 02:29:56 UTC

[GitHub] [james-project] chibenwa opened a new pull request #284: JAMES-2453 Remove JUNIT 4 usages in server/protocols

chibenwa opened a new pull request #284:
URL: https://github.com/apache/james-project/pull/284


   (Except soon-to-be-deprecated JMAP draft)
   
   Now we remain:
   
   ```
   $ grep 'import org.junit.Test;' * -R | wc -l
   357
   ```
   
   119 being caused by JMAP draft


----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [james-project] Arsnael commented on a change in pull request #284: JAMES-2453 Remove JUNIT 4 usages in server/protocols

Posted by GitBox <gi...@apache.org>.
Arsnael commented on a change in pull request #284:
URL: https://github.com/apache/james-project/pull/284#discussion_r553105883



##########
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:
       Not this one, it's an extension declaration that will be used in oither Test classes `SpamAssassinTest` and `SpamAssassinHandlerTest` :) 




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [james-project] Arsnael closed pull request #284: JAMES-2453 Remove JUNIT 4 usages in server/protocols

Posted by GitBox <gi...@apache.org>.
Arsnael closed pull request #284:
URL: https://github.com/apache/james-project/pull/284


   


----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [james-project] Arsnael commented on pull request #284: JAMES-2453 Remove JUNIT 4 usages in server/protocols

Posted by GitBox <gi...@apache.org>.
Arsnael commented on pull request #284:
URL: https://github.com/apache/james-project/pull/284#issuecomment-755959238


   Let me know if your concerns got answered @jeantil :) 


----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [james-project] jeantil commented on a change in pull request #284: JAMES-2453 Remove JUNIT 4 usages in server/protocols

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



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


[GitHub] [james-project] Arsnael commented on a change in pull request #284: JAMES-2453 Remove JUNIT 4 usages in server/protocols

Posted by GitBox <gi...@apache.org>.
Arsnael commented on a change in pull request #284:
URL: https://github.com/apache/james-project/pull/284#discussion_r553105883



##########
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:
       Not this one, it's an extension declaration that is used in other Test classes `SpamAssassinTest` and `SpamAssassinHandlerTest` :) 




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [james-project] Arsnael commented on pull request #284: JAMES-2453 Remove JUNIT 4 usages in server/protocols

Posted by GitBox <gi...@apache.org>.
Arsnael commented on pull request #284:
URL: https://github.com/apache/james-project/pull/284#issuecomment-758581908


   Merged


----------------------------------------------------------------
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:
users@infra.apache.org



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