chibenwa commented on code in PR #1674:
URL: https://github.com/apache/james-project/pull/1674#discussion_r1292850284


##########
mailbox/store/src/test/java/org/apache/james/mailbox/store/event/MailboxSubscriptionListenerTest.java:
##########
@@ -0,0 +1,183 @@
+/****************************************************************
+ * 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.mailbox.store.event;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+import static org.mockito.Mockito.when;
+
+import org.apache.james.core.Username;
+import org.apache.james.events.Event;
+import org.apache.james.events.Group;
+import org.apache.james.mailbox.MailboxSession;
+import org.apache.james.mailbox.MailboxSessionUtil;
+import org.apache.james.mailbox.SessionProvider;
+import org.apache.james.mailbox.SubscriptionManager;
+import org.apache.james.mailbox.events.MailboxEvents;
+import org.apache.james.mailbox.model.Mailbox;
+import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mailbox.model.TestId;
+import org.apache.james.mailbox.store.MailboxSessionMapperFactory;
+import org.apache.james.mailbox.store.mail.MailboxMapper;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+class MailboxSubscriptionListenerTest {
+    private static final Username BOB = Username.of("bob");
+    private static final MailboxSession BOB_SESSION = 
MailboxSessionUtil.create(BOB);
+    private static final MailboxPath PARENT1 = new MailboxPath("namespace", 
BOB, "parent1");
+    private static final MailboxPath PARENT1_CHILD1 = new 
MailboxPath("namespace", BOB, "parent1.child1");
+    private static final MailboxPath PARENT1_CHILD1_CHILD1 = new 
MailboxPath("namespace", BOB, "parent1.child1.child1");
+    private static final MailboxPath PARENT1_CHILD1_CHILD2 = new 
MailboxPath("namespace", BOB, "parent1.child2");
+    private static final TestId MAILBOX_ID = TestId.of(45);
+
+    @Mock
+    SessionProvider sessionProvider;
+
+    @Mock
+    SubscriptionManager subscriptionManager;
+
+    @Mock
+    MailboxSessionMapperFactory mailboxSessionMapperFactory;
+
+    @Mock
+    MailboxMapper mailboxMapper;

Review Comment:
   Please work with memory data structures here, we do not need to assert `how` 
the job is done, which is a duplication of the code, but `what is the end 
result`.
   
   Mocked tests are a pain to maintain, and shall be strictly avoided and usage 
limited to necessary solutions. The team developped over the years effective 
solutions to avoid their usage, memory utilities being one of them.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to