This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 4800262eec4411b6127b91588e06da13bfc6523d
Author: Rene Cordier <rcord...@linagora.com>
AuthorDate: Thu Dec 5 15:48:11 2019 +0700

    [Refactoring] Move MailboxAnnotationListenerTest to JUnit 5
---
 .../store/event/MailboxAnnotationListenerTest.java | 51 +++++++++++-----------
 1 file changed, 25 insertions(+), 26 deletions(-)

diff --git 
a/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/MailboxAnnotationListenerTest.java
 
b/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/MailboxAnnotationListenerTest.java
index 3aad5ba..fbc85a3 100644
--- 
a/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/MailboxAnnotationListenerTest.java
+++ 
b/mailbox/store/src/test/java/org/apache/james/mailbox/store/event/MailboxAnnotationListenerTest.java
@@ -47,38 +47,37 @@ import org.apache.james.mailbox.model.QuotaRoot;
 import org.apache.james.mailbox.model.TestId;
 import org.apache.james.mailbox.store.MailboxSessionMapperFactory;
 import org.apache.james.mailbox.store.mail.AnnotationMapper;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
 import com.google.common.collect.ImmutableList;
 
-public class MailboxAnnotationListenerTest {
-    private static final Username USER = Username.of("user");
-    private static final MailboxPath MAILBOX_PATH = new 
MailboxPath("namespace", USER, "name");
+class MailboxAnnotationListenerTest {
+    static final Username USER = Username.of("user");
+    static final MailboxPath MAILBOX_PATH = new MailboxPath("namespace", USER, 
"name");
 
-    private static final MailboxAnnotationKey PRIVATE_KEY = new 
MailboxAnnotationKey("/private/comment");
-    private static final MailboxAnnotationKey SHARED_KEY = new 
MailboxAnnotationKey("/shared/comment");
+    static final MailboxAnnotationKey PRIVATE_KEY = new 
MailboxAnnotationKey("/private/comment");
+    static final MailboxAnnotationKey SHARED_KEY = new 
MailboxAnnotationKey("/shared/comment");
 
-    private static final MailboxAnnotation PRIVATE_ANNOTATION = 
MailboxAnnotation.newInstance(PRIVATE_KEY, "My private comment");
-    private static final MailboxAnnotation SHARED_ANNOTATION =  
MailboxAnnotation.newInstance(SHARED_KEY, "My shared comment");
+    static final MailboxAnnotation PRIVATE_ANNOTATION = 
MailboxAnnotation.newInstance(PRIVATE_KEY, "My private comment");
+    static final MailboxAnnotation SHARED_ANNOTATION =  
MailboxAnnotation.newInstance(SHARED_KEY, "My shared comment");
 
-    private static final List<MailboxAnnotation> ANNOTATIONS = 
ImmutableList.of(PRIVATE_ANNOTATION, SHARED_ANNOTATION);
-    public static final int UID_VALIDITY = 145;
-    public static final TestId MAILBOX_ID = TestId.of(45);
+    static final List<MailboxAnnotation> ANNOTATIONS = 
ImmutableList.of(PRIVATE_ANNOTATION, SHARED_ANNOTATION);
+    static final TestId MAILBOX_ID = TestId.of(45);
 
-    @Mock private SessionProvider sessionProvider;
-    @Mock private MailboxSessionMapperFactory mailboxSessionMapperFactory;
-    @Mock private AnnotationMapper annotationMapper;
-    @Mock private MailboxId mailboxId;
+    @Mock SessionProvider sessionProvider;
+    @Mock MailboxSessionMapperFactory mailboxSessionMapperFactory;
+    @Mock AnnotationMapper annotationMapper;
+    @Mock MailboxId mailboxId;
 
-    private MailboxAnnotationListener listener;
-    private MailboxListener.MailboxEvent deleteEvent;
-    private MailboxSession mailboxSession;
+    MailboxAnnotationListener listener;
+    MailboxListener.MailboxEvent deleteEvent;
+    MailboxSession mailboxSession;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() throws Exception {
         MockitoAnnotations.initMocks(this);
         mailboxSession = MailboxSessionUtil.create(Username.of("test"));
         listener = new MailboxAnnotationListener(mailboxSessionMapperFactory, 
sessionProvider);
@@ -99,13 +98,13 @@ public class MailboxAnnotationListenerTest {
     }
 
     @Test
-    public void deserializeMailboxAnnotationListenerGroup() throws Exception {
+    void deserializeMailboxAnnotationListenerGroup() throws Exception {
         
assertThat(Group.deserialize("org.apache.james.mailbox.store.event.MailboxAnnotationListener$MailboxAnnotationListenerGroup"))
             .isEqualTo(new 
MailboxAnnotationListener.MailboxAnnotationListenerGroup());
     }
 
     @Test
-    public void eventShouldDoNothingIfDoNotHaveMailboxDeletionEvent() throws 
Exception {
+    void eventShouldDoNothingIfDoNotHaveMailboxDeletionEvent() throws 
Exception {
         MailboxListener.MailboxEvent event = new 
MailboxListener.MailboxAdded(null, null, MAILBOX_PATH, MAILBOX_ID, 
Event.EventId.random());
         listener.event(event);
 
@@ -114,7 +113,7 @@ public class MailboxAnnotationListenerTest {
     }
 
     @Test
-    public void eventShoudlDoNothingIfMailboxDoesNotHaveAnyAnnotation() throws 
Exception {
+    void eventShoudlDoNothingIfMailboxDoesNotHaveAnyAnnotation() throws 
Exception {
         
when(annotationMapper.getAllAnnotations(any(MailboxId.class))).thenReturn(ImmutableList.<MailboxAnnotation>of());
 
         listener.event(deleteEvent);
@@ -128,7 +127,7 @@ public class MailboxAnnotationListenerTest {
     }
 
     @Test
-    public void eventShoudlDeleteAllMailboxAnnotation() throws Exception {
+    void eventShoudlDeleteAllMailboxAnnotation() throws Exception {
         
when(annotationMapper.getAllAnnotations(eq(mailboxId))).thenReturn(ANNOTATIONS);
 
         listener.event(deleteEvent);
@@ -144,7 +143,7 @@ public class MailboxAnnotationListenerTest {
     }
 
     @Test
-    public void eventShouldPropagateFailure() throws Exception {
+    void eventShouldPropagateFailure() throws Exception {
         
when(annotationMapper.getAllAnnotations((eq(mailboxId)))).thenReturn(ANNOTATIONS);
         doThrow(new 
RuntimeException()).when(annotationMapper).deleteAnnotation(eq(mailboxId), 
eq(PRIVATE_KEY));
 


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to