You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/11/15 02:41:28 UTC
[james-project] 19/30: [Refactoring] Moving remaining tests in
mailbox api to JUnit 5
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 07651c001b5efb411528f5657e3653abbae3c2f6
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Mon Nov 11 16:23:50 2019 +0700
[Refactoring] Moving remaining tests in mailbox api to JUnit 5
Except for AbstractSubscriptionManagerTest and MailboxManagerStressTest.
Those are trickier and require quite some work with the implementation classes depending on it.
---
.../james/mailbox/ApplicableFlagBuilderTest.java | 68 ++++++++-------
.../james/mailbox/ComposedMessageIdTest.java | 6 +-
.../apache/james/mailbox/MailboxExceptionTest.java | 96 +++++++++++-----------
.../apache/james/mailbox/MailboxManagerTest.java | 4 +-
.../apache/james/mailbox/MessageMoveEventTest.java | 38 ++++-----
.../org/apache/james/mailbox/MessageUidTest.java | 21 ++---
.../java/org/apache/james/mailbox/RoleTest.java | 56 ++++++-------
7 files changed, 146 insertions(+), 143 deletions(-)
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/ApplicableFlagBuilderTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/ApplicableFlagBuilderTest.java
index 520e7e5..8982b18 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/ApplicableFlagBuilderTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/ApplicableFlagBuilderTest.java
@@ -22,47 +22,47 @@ import static org.assertj.core.api.Assertions.assertThat;
import javax.mail.Flags;
-import org.assertj.core.api.JUnitSoftAssertions;
-import org.junit.Rule;
-import org.junit.Test;
+import org.assertj.core.api.SoftAssertions;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.ImmutableList;
-public class ApplicableFlagBuilderTest {
-
- @Rule
- public final JUnitSoftAssertions softly = new JUnitSoftAssertions();
+class ApplicableFlagBuilderTest {
@Test
- public void shouldAtLeastContainAllDefaultApplicativeFlag() {
+ void shouldAtLeastContainAllDefaultApplicativeFlag() {
assertThat(ApplicableFlagBuilder.builder().build())
.isEqualTo(ApplicableFlagBuilder.DEFAULT_APPLICABLE_FLAGS);
}
@Test
- public void shouldNeverRetainRecentAndUserFlag() {
+ void shouldNeverRetainRecentAndUserFlag() {
Flags result = ApplicableFlagBuilder.builder()
.add(new Flags(Flags.Flag.RECENT))
.add(new Flags(Flags.Flag.USER))
.build();
- softly.assertThat(result.contains(Flags.Flag.RECENT)).isFalse();
- softly.assertThat(result.contains(Flags.Flag.USER)).isFalse();
+ SoftAssertions.assertSoftly(softly -> {
+ softly.assertThat(result.contains(Flags.Flag.RECENT)).isFalse();
+ softly.assertThat(result.contains(Flags.Flag.USER)).isFalse();
+ });
}
@Test
- public void shouldAddCustomUserFlagIfProvidedToDefaultFlag() {
+ void shouldAddCustomUserFlagIfProvidedToDefaultFlag() {
Flags result = ApplicableFlagBuilder.builder()
.add("yolo", "vibe")
.build();
- softly.assertThat(result.contains(ApplicableFlagBuilder.DEFAULT_APPLICABLE_FLAGS)).isTrue();
- softly.assertThat(result.contains("yolo")).isTrue();
- softly.assertThat(result.contains("vibe")).isTrue();
+ SoftAssertions.assertSoftly(softly -> {
+ softly.assertThat(result.contains(ApplicableFlagBuilder.DEFAULT_APPLICABLE_FLAGS)).isTrue();
+ softly.assertThat(result.contains("yolo")).isTrue();
+ softly.assertThat(result.contains("vibe")).isTrue();
+ });
}
@Test
- public void shouldAcceptUserCustomFlagInsideFlags() {
+ void shouldAcceptUserCustomFlagInsideFlags() {
Flags result = ApplicableFlagBuilder.builder()
.add(new Flags("yolo"))
.build();
@@ -71,7 +71,7 @@ public class ApplicableFlagBuilderTest {
}
@Test
- public void shouldAcceptFlagsThatContainMultipleFlag() {
+ void shouldAcceptFlagsThatContainMultipleFlag() {
Flags flags = FlagsBuilder.builder()
.add("yolo", "vibes")
.build();
@@ -80,42 +80,50 @@ public class ApplicableFlagBuilderTest {
.add(flags)
.build();
- softly.assertThat(result.contains("yolo")).isTrue();
- softly.assertThat(result.contains("vibes")).isTrue();
+ SoftAssertions.assertSoftly(softly -> {
+ softly.assertThat(result.contains("yolo")).isTrue();
+ softly.assertThat(result.contains("vibes")).isTrue();
+ });
}
@Test
- public void addShouldAddMultipleFlagsAtOnce() {
+ void addShouldAddMultipleFlagsAtOnce() {
Flags flags = new Flags("cartman");
Flags flags2 = new Flags("butters");
Flags result = ApplicableFlagBuilder.builder()
.add(flags, flags2)
.build();
- softly.assertThat(result.contains(flags)).isTrue();
- softly.assertThat(result.contains(flags2)).isTrue();
+ SoftAssertions.assertSoftly(softly -> {
+ softly.assertThat(result.contains(flags)).isTrue();
+ softly.assertThat(result.contains(flags2)).isTrue();
+ });
}
@Test
- public void shouldAcceptMultipleFlagAtOnce() {
+ void shouldAcceptMultipleFlagAtOnce() {
Flags result = ApplicableFlagBuilder.builder()
.add("cartman", "butters")
.add("chef", "randy")
.build();
- softly.assertThat(result.contains("cartman")).isTrue();
- softly.assertThat(result.contains("butters")).isTrue();
- softly.assertThat(result.contains("chef")).isTrue();
- softly.assertThat(result.contains("randy")).isTrue();
+ SoftAssertions.assertSoftly(softly -> {
+ softly.assertThat(result.contains("cartman")).isTrue();
+ softly.assertThat(result.contains("butters")).isTrue();
+ softly.assertThat(result.contains("chef")).isTrue();
+ softly.assertThat(result.contains("randy")).isTrue();
+ });
}
@Test
- public void shouldAcceptListOfFlags() throws Exception {
+ void shouldAcceptListOfFlags() throws Exception {
Flags result = ApplicableFlagBuilder.builder()
.add(ImmutableList.of(new Flags("cartman"), new Flags("chef")))
.build();
- softly.assertThat(result.contains("cartman")).isTrue();
- softly.assertThat(result.contains("chef")).isTrue();
+ SoftAssertions.assertSoftly(softly -> {
+ softly.assertThat(result.contains("cartman")).isTrue();
+ softly.assertThat(result.contains("chef")).isTrue();
+ });
}
}
\ No newline at end of file
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/ComposedMessageIdTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/ComposedMessageIdTest.java
index 63b3c8f..a82c5d0 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/ComposedMessageIdTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/ComposedMessageIdTest.java
@@ -20,14 +20,14 @@
package org.apache.james.mailbox;
import org.apache.james.mailbox.model.ComposedMessageId;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import nl.jqno.equalsverifier.EqualsVerifier;
-public class ComposedMessageIdTest {
+class ComposedMessageIdTest {
@Test
- public void composedMessageIdShouldRespectBeanContract() {
+ void composedMessageIdShouldRespectBeanContract() {
EqualsVerifier.forClass(ComposedMessageId.class)
.verify();
}
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxExceptionTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxExceptionTest.java
index e90a057..878b599 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxExceptionTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxExceptionTest.java
@@ -1,48 +1,48 @@
-/****************************************************************
- * 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;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import org.apache.james.mailbox.exception.MailboxException;
-import org.junit.Test;
-
-/**
- * Ensure that {@link MailboxException} construction is correct.
- */
-public class MailboxExceptionTest {
-
- private static final String EXCEPTION_MESSAGE = "this is an exception message";
- private static final String CAUSE_MESSAGE = "this is a cause";
- private static final Exception EXCEPTION_CAUSE = new Exception(CAUSE_MESSAGE);
-
- @Test
- public void testMailboxExceptionMessage() {
- MailboxException mbe = new MailboxException(EXCEPTION_MESSAGE);
- assertThat(mbe).hasMessage(EXCEPTION_MESSAGE);
- }
-
- @Test
- public void testMailboxExceptionCause() {
- MailboxException mbe = new MailboxException(EXCEPTION_MESSAGE, EXCEPTION_CAUSE);
- assertThat(mbe).hasMessage(EXCEPTION_MESSAGE).hasCauseExactlyInstanceOf(Exception.class);
- assertThat(mbe.getCause()).hasMessage(CAUSE_MESSAGE);
- }
-
-}
+/****************************************************************
+ * 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;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.james.mailbox.exception.MailboxException;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Ensure that {@link MailboxException} construction is correct.
+ */
+class MailboxExceptionTest {
+
+ private static final String EXCEPTION_MESSAGE = "this is an exception message";
+ private static final String CAUSE_MESSAGE = "this is a cause";
+ private static final Exception EXCEPTION_CAUSE = new Exception(CAUSE_MESSAGE);
+
+ @Test
+ void testMailboxExceptionMessage() {
+ MailboxException mbe = new MailboxException(EXCEPTION_MESSAGE);
+ assertThat(mbe).hasMessage(EXCEPTION_MESSAGE);
+ }
+
+ @Test
+ void testMailboxExceptionCause() {
+ MailboxException mbe = new MailboxException(EXCEPTION_MESSAGE, EXCEPTION_CAUSE);
+ assertThat(mbe).hasMessage(EXCEPTION_MESSAGE).hasCauseExactlyInstanceOf(Exception.class);
+ assertThat(mbe.getCause()).hasMessage(CAUSE_MESSAGE);
+ }
+
+}
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
index 7d2863d..c68a380 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
@@ -144,7 +144,7 @@ public abstract class MailboxManagerTest<T extends MailboxManager> {
}
@Test
- public void creatingConcurrentlyMailboxesWithSameParentShouldNotFail() throws Exception {
+ protected void creatingConcurrentlyMailboxesWithSameParentShouldNotFail() throws Exception {
MailboxSession session = mailboxManager.createSystemSession(USER_1);
String mailboxName = "a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z";
@@ -155,7 +155,7 @@ public abstract class MailboxManagerTest<T extends MailboxManager> {
}
@Test
- public void createMailboxShouldReturnRightId() throws Exception {
+ void createMailboxShouldReturnRightId() throws Exception {
session = mailboxManager.createSystemSession(USER_1);
mailboxManager.startProcessingRequest(session);
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/MessageMoveEventTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/MessageMoveEventTest.java
index 02688da..4a591c3 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/MessageMoveEventTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/MessageMoveEventTest.java
@@ -26,31 +26,27 @@ import org.apache.james.mailbox.events.MessageMoveEvent;
import org.apache.james.mailbox.model.MessageMoves;
import org.apache.james.mailbox.model.TestId;
import org.apache.james.mailbox.model.TestMessageId;
-import org.assertj.core.api.JUnitSoftAssertions;
-import org.junit.Rule;
-import org.junit.Test;
+import org.assertj.core.api.SoftAssertions;
+import org.junit.jupiter.api.Test;
import nl.jqno.equalsverifier.EqualsVerifier;
-public class MessageMoveEventTest {
-
- @Rule
- public JUnitSoftAssertions softly = new JUnitSoftAssertions();
+class MessageMoveEventTest {
@Test
- public void shouldRespectBeanContract() {
+ void shouldRespectBeanContract() {
EqualsVerifier.forClass(MessageMoveEvent.class).verify();
}
@Test
- public void builderShouldThrowWhenSessionIsNull() {
+ void builderShouldThrowWhenSessionIsNull() {
assertThatThrownBy(() -> MessageMoveEvent.builder()
.build())
.isInstanceOf(NullPointerException.class);
}
@Test
- public void builderShouldThrowWhenMessageMovesIsNull() {
+ void builderShouldThrowWhenMessageMovesIsNull() {
assertThatThrownBy(() -> MessageMoveEvent.builder()
.session(MailboxSessionUtil.create("user@james.org"))
.build())
@@ -58,7 +54,7 @@ public class MessageMoveEventTest {
}
@Test
- public void builderShouldReturnNoopWhenMessagesIsEmpty() {
+ void builderShouldReturnNoopWhenMessagesIsEmpty() {
assertThat(MessageMoveEvent.builder()
.session(MailboxSessionUtil.create("user@james.org"))
.messageMoves(MessageMoves.builder()
@@ -70,7 +66,7 @@ public class MessageMoveEventTest {
}
@Test
- public void builderShouldNotBeNoopWhenFieldsAreGiven() {
+ void builderShouldNotBeNoopWhenFieldsAreGiven() {
MailboxSession session = MailboxSessionUtil.create("user@james.org");
MessageMoves messageMoves = MessageMoves.builder()
.targetMailboxIds(TestId.of(2))
@@ -87,7 +83,7 @@ public class MessageMoveEventTest {
}
@Test
- public void builderShouldBuildWhenFieldsAreGiven() {
+ void builderShouldBuildWhenFieldsAreGiven() {
String username = "user@james.org";
MailboxSession session = MailboxSessionUtil.create(username);
MessageMoves messageMoves = MessageMoves.builder()
@@ -102,13 +98,15 @@ public class MessageMoveEventTest {
.messageId(messageId)
.build();
- softly.assertThat(event.getUsername()).isEqualTo(Username.of(username));
- softly.assertThat(event.getMessageMoves()).isEqualTo(messageMoves);
- softly.assertThat(event.getMessageIds()).containsExactly(messageId);
+ SoftAssertions.assertSoftly(softly -> {
+ softly.assertThat(event.getUsername()).isEqualTo(Username.of(username));
+ softly.assertThat(event.getMessageMoves()).isEqualTo(messageMoves);
+ softly.assertThat(event.getMessageIds()).containsExactly(messageId);
+ });
}
@Test
- public void isMoveToShouldReturnFalseWhenMailboxIdIsNotInAddedMailboxIds() {
+ void isMoveToShouldReturnFalseWhenMailboxIdIsNotInAddedMailboxIds() {
MessageMoveEvent event = MessageMoveEvent.builder()
.session(MailboxSessionUtil.create("user@james.org"))
.messageMoves(MessageMoves.builder()
@@ -121,7 +119,7 @@ public class MessageMoveEventTest {
}
@Test
- public void isMoveToShouldReturnTrueWhenMailboxIdIsInAddedMailboxIds() {
+ void isMoveToShouldReturnTrueWhenMailboxIdIsInAddedMailboxIds() {
TestId mailboxId = TestId.of(123);
MessageMoveEvent event = MessageMoveEvent.builder()
.session(MailboxSessionUtil.create("user@james.org"))
@@ -135,7 +133,7 @@ public class MessageMoveEventTest {
}
@Test
- public void isMoveFromShouldReturnFalseWhenMailboxIdIsNotInRemovedMailboxIds() {
+ void isMoveFromShouldReturnFalseWhenMailboxIdIsNotInRemovedMailboxIds() {
MessageMoveEvent event = MessageMoveEvent.builder()
.session(MailboxSessionUtil.create("user@james.org"))
.messageMoves(MessageMoves.builder()
@@ -148,7 +146,7 @@ public class MessageMoveEventTest {
}
@Test
- public void isMoveFromShouldReturnTrueWhenMailboxIdIsInRemovedMailboxIds() {
+ void isMoveFromShouldReturnTrueWhenMailboxIdIsInRemovedMailboxIds() {
TestId mailboxId = TestId.of(123);
MessageMoveEvent event = MessageMoveEvent.builder()
.session(MailboxSessionUtil.create("user@james.org"))
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/MessageUidTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/MessageUidTest.java
index ee3f42e..89c6cdf 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/MessageUidTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/MessageUidTest.java
@@ -19,14 +19,11 @@
package org.apache.james.mailbox;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
-public class MessageUidTest {
-
- @Rule public ExpectedException exception = ExpectedException.none();
+class MessageUidTest {
private static final MessageUid _1 = MessageUid.of(1);
private static final MessageUid _2 = MessageUid.of(2);
@@ -34,24 +31,24 @@ public class MessageUidTest {
private static final MessageUid _4 = MessageUid.of(4);
@Test
- public void distanceShouldReturnZeroWhenSameValue() {
+ void distanceShouldReturnZeroWhenSameValue() {
assertThat(_1.distance(_1)).isEqualTo(0);
}
@Test
- public void distanceShouldThrowWhenNullArgument() {
- exception.expect(NullPointerException.class);
- _1.distance(null);
+ void distanceShouldThrowWhenNullArgument() {
+ assertThatThrownBy(() -> _1.distance(null))
+ .isInstanceOf(NullPointerException.class);
}
@Test
- public void distanceShouldReturnPositiveDistanceWhenGreaterArgument() {
+ void distanceShouldReturnPositiveDistanceWhenGreaterArgument() {
assertThat(_1.distance(_4)).isEqualTo(3);
}
@Test
- public void distanceShouldReturnNegativeDistanceWhenSmallerArgument() {
+ void distanceShouldReturnNegativeDistanceWhenSmallerArgument() {
assertThat(_3.distance(_2)).isEqualTo(-1);
}
}
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/RoleTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/RoleTest.java
index 6352a07..b612fb3 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/RoleTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/RoleTest.java
@@ -23,28 +23,28 @@ import static org.assertj.core.api.Assertions.assertThat;
import java.util.Locale;
import java.util.Optional;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class RoleTest {
+class RoleTest {
@Test
- public void fromShouldReturnEmptyWhenUnknownValue() {
+ void fromShouldReturnEmptyWhenUnknownValue() {
assertThat(Role.from("jjjj")).isEqualTo(Optional.empty());
}
@Test
- public void fromShouldReturnSomethingWhenXPrefixedRole() {
+ void fromShouldReturnSomethingWhenXPrefixedRole() {
assertThat(Role.from("x-client-specific-role")).isEqualTo(Optional.of(new Role("x-client-specific-role")));
}
@Test
- public void isSystemRoleShouldReturnFalseWhenXPrefixedRole() {
+ void isSystemRoleShouldReturnFalseWhenXPrefixedRole() {
Role role = Role.from("x-client-specific-role").get();
assertThat(role.isSystemRole()).isFalse();
}
@Test
- public void fromShouldReturnInboxWhenContainsUppercaseValueInTurkish() {
+ void fromShouldReturnInboxWhenContainsUppercaseValueInTurkish() {
Locale previousLocale = Locale.getDefault();
Locale.setDefault(Locale.forLanguageTag("tr"));
try {
@@ -55,124 +55,124 @@ public class RoleTest {
}
@Test
- public void isSystemRoleShouldBeTrueWhenInbox() {
+ void isSystemRoleShouldBeTrueWhenInbox() {
assertThat(Role.INBOX.isSystemRole()).isTrue();
}
@Test
- public void isSystemRoleShouldBeTrueWhenArchive() {
+ void isSystemRoleShouldBeTrueWhenArchive() {
assertThat(Role.ARCHIVE.isSystemRole()).isTrue();
}
@Test
- public void isSystemRoleShouldBeTrueWhenDrafts() {
+ void isSystemRoleShouldBeTrueWhenDrafts() {
assertThat(Role.DRAFTS.isSystemRole()).isTrue();
}
@Test
- public void isSystemRoleShouldBeTrueWhenOutbox() {
+ void isSystemRoleShouldBeTrueWhenOutbox() {
assertThat(Role.OUTBOX.isSystemRole()).isTrue();
}
@Test
- public void isSystemRoleShouldBeTrueWhenSent() {
+ void isSystemRoleShouldBeTrueWhenSent() {
assertThat(Role.SENT.isSystemRole()).isTrue();
}
@Test
- public void isSystemRoleShouldBeTrueWhenTrash() {
+ void isSystemRoleShouldBeTrueWhenTrash() {
assertThat(Role.TRASH.isSystemRole()).isTrue();
}
@Test
- public void isSystemRoleShouldBeTrueWhenSpam() {
+ void isSystemRoleShouldBeTrueWhenSpam() {
assertThat(Role.SPAM.isSystemRole()).isTrue();
}
@Test
- public void isSystemRoleShouldBeTrueWhenTemplates() {
+ void isSystemRoleShouldBeTrueWhenTemplates() {
assertThat(Role.TEMPLATES.isSystemRole()).isTrue();
}
@Test
- public void isSystemRoleShouldBeTrueWhenRestoredMessages() {
+ void isSystemRoleShouldBeTrueWhenRestoredMessages() {
assertThat(Role.RESTORED_MESSAGES.isSystemRole()).isTrue();
}
@Test
- public void isSystemRoleShouldBeFalseWhenUserDefinedRole() {
+ void isSystemRoleShouldBeFalseWhenUserDefinedRole() {
Role userRole = Role.from(Role.USER_DEFINED_ROLE_PREFIX + "myRole").get();
assertThat(userRole.isSystemRole()).isFalse();
}
@Test
- public void theINBOXMailboxNameShouldBeASystemMailbox() {
+ void theINBOXMailboxNameShouldBeASystemMailbox() {
Role role = Role.from("INBOX").get();
assertThat(role.isSystemRole()).isTrue();
}
@Test
- public void theInBoXMailboxNameShouldBeASystemMailbox() {
+ void theInBoXMailboxNameShouldBeASystemMailbox() {
Role role = Role.from("InBoX").get();
assertThat(role.isSystemRole()).isTrue();
}
@Test
- public void theDraftsMailboxNameShouldBeASystemMailbox() {
+ void theDraftsMailboxNameShouldBeASystemMailbox() {
Role role = Role.from("Drafts").get();
assertThat(role.isSystemRole()).isTrue();
}
@Test
- public void theDrAfTsMailboxNameShouldNotBeASystemMailbox() {
+ void theDrAfTsMailboxNameShouldNotBeASystemMailbox() {
Optional<Role> role = Role.from("DrAfTs");
assertThat(role).isEmpty();
}
@Test
- public void theOutboxMailboxNameShouldBeASystemMailbox() {
+ void theOutboxMailboxNameShouldBeASystemMailbox() {
Role role = Role.from("Outbox").get();
assertThat(role.isSystemRole()).isTrue();
}
@Test
- public void theOuTbOxMailboxNameShouldNotBeASystemMailbox() {
+ void theOuTbOxMailboxNameShouldNotBeASystemMailbox() {
Optional<Role> role = Role.from("OuTbOx");
assertThat(role).isEmpty();
}
@Test
- public void theSentMailboxNameShouldBeASystemMailbox() {
+ void theSentMailboxNameShouldBeASystemMailbox() {
Role role = Role.from("Sent").get();
assertThat(role.isSystemRole()).isTrue();
}
@Test
- public void theSeNtMailboxNameShouldNotBeASystemMailbox() {
+ void theSeNtMailboxNameShouldNotBeASystemMailbox() {
Optional<Role> role = Role.from("SeNt");
assertThat(role).isEmpty();
}
@Test
- public void theTrashMailboxNameShouldBeASystemMailbox() {
+ void theTrashMailboxNameShouldBeASystemMailbox() {
Role role = Role.from("Trash").get();
assertThat(role.isSystemRole()).isTrue();
}
@Test
- public void theTrAsHMailboxNameShouldNotBeASystemMailbox() {
+ void theTrAsHMailboxNameShouldNotBeASystemMailbox() {
Optional<Role> role = Role.from("TrAsH");
assertThat(role).isEmpty();
}
@Test
- public void theRestoredMessagesMailboxNameShouldBeASystemMailbox() {
+ void theRestoredMessagesMailboxNameShouldBeASystemMailbox() {
Role role = Role.from("Restored-Messages").get();
assertThat(role.isSystemRole()).isTrue();
}
@Test
- public void theReStOrEdMeSsAgEsMailboxNameShouldNotBeASystemMailbox() {
+ void theReStOrEdMeSsAgEsMailboxNameShouldNotBeASystemMailbox() {
Optional<Role> role = Role.from("ReStOrEd-MeSsAgEs");
assertThat(role).isEmpty();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org