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 73a9151d3f815f9b5bec0c846c45876b8179ee88 Author: Rene Cordier <rcord...@linagora.com> AuthorDate: Thu Dec 5 17:10:38 2019 +0700 [Refactoring] Move StoreBlobManagerTest to JUnit 5 --- .../james/mailbox/store/StoreBlobManagerTest.java | 60 +++++++++++----------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/StoreBlobManagerTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/StoreBlobManagerTest.java index 26bfd1d..91b6661 100644 --- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/StoreBlobManagerTest.java +++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/StoreBlobManagerTest.java @@ -45,27 +45,27 @@ import org.apache.james.mailbox.model.Content; import org.apache.james.mailbox.model.FetchGroup; import org.apache.james.mailbox.model.MessageResult; import org.apache.james.mailbox.model.TestMessageId; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import com.google.common.collect.ImmutableList; -public class StoreBlobManagerTest { - public static final String ID = "abc"; - public static final AttachmentId ATTACHMENT_ID = AttachmentId.from(ID); - public static final String CONTENT_TYPE = "text/plain"; - public static final byte[] BYTES = "abc".getBytes(StandardCharsets.UTF_8); - public static final TestMessageId MESSAGE_ID = TestMessageId.of(125); - public static final BlobId BLOB_ID_ATTACHMENT = BlobId.fromString(ID); - public static final BlobId BLOB_ID_MESSAGE = BlobId.fromString(MESSAGE_ID.serialize()); - private StoreBlobManager blobManager; - - private AttachmentManager attachmentManager; - private MessageIdManager messageIdManager; - private MailboxSession session; - - @Before - public void setUp() { +class StoreBlobManagerTest { + static final String ID = "abc"; + static final AttachmentId ATTACHMENT_ID = AttachmentId.from(ID); + static final String CONTENT_TYPE = "text/plain"; + static final byte[] BYTES = "abc".getBytes(StandardCharsets.UTF_8); + static final TestMessageId MESSAGE_ID = TestMessageId.of(125); + static final BlobId BLOB_ID_ATTACHMENT = BlobId.fromString(ID); + static final BlobId BLOB_ID_MESSAGE = BlobId.fromString(MESSAGE_ID.serialize()); + StoreBlobManager blobManager; + + AttachmentManager attachmentManager; + MessageIdManager messageIdManager; + MailboxSession session; + + @BeforeEach + void setUp() { attachmentManager = mock(AttachmentManager.class); messageIdManager = mock(MessageIdManager.class); session = MailboxSessionUtil.create(Username.of("user")); @@ -74,7 +74,7 @@ public class StoreBlobManagerTest { } @Test - public void retrieveShouldReturnBlobWhenAttachment() throws Exception { + void retrieveShouldReturnBlobWhenAttachment() throws Exception { when(attachmentManager.getAttachment(ATTACHMENT_ID, session)) .thenReturn(Attachment.builder() .attachmentId(ATTACHMENT_ID) @@ -91,7 +91,7 @@ public class StoreBlobManagerTest { } @Test - public void retrieveShouldThrowWhenNotFound() throws Exception { + void retrieveShouldThrowWhenNotFound() throws Exception { when(attachmentManager.getAttachment(ATTACHMENT_ID, session)) .thenThrow(new AttachmentNotFoundException(ID)); when(messageIdManager.getMessages(ImmutableList.of(MESSAGE_ID), FetchGroup.FULL_CONTENT, session)) @@ -102,7 +102,7 @@ public class StoreBlobManagerTest { } @Test - public void retrieveShouldReturnBlobWhenMessage() throws Exception { + void retrieveShouldReturnBlobWhenMessage() throws Exception { when(attachmentManager.getAttachment(any(), any())) .thenThrow(new AttachmentNotFoundException(ID)); @@ -122,7 +122,7 @@ public class StoreBlobManagerTest { } @Test - public void retrieveShouldThrowOnMailboxExceptionWhenRetrievingAttachment() throws Exception { + void retrieveShouldThrowOnMailboxExceptionWhenRetrievingAttachment() throws Exception { when(attachmentManager.getAttachment(any(), any())) .thenThrow(new MailboxException()); @@ -131,7 +131,7 @@ public class StoreBlobManagerTest { } @Test - public void retrieveShouldThrowOnRuntimeExceptionWhenRetrievingAttachment() throws Exception { + void retrieveShouldThrowOnRuntimeExceptionWhenRetrievingAttachment() throws Exception { when(attachmentManager.getAttachment(any(), any())) .thenThrow(new RuntimeException()); @@ -140,7 +140,7 @@ public class StoreBlobManagerTest { } @Test - public void retrieveShouldThrowOnRuntimeExceptionWhenRetrievingMessage() throws Exception { + void retrieveShouldThrowOnRuntimeExceptionWhenRetrievingMessage() throws Exception { when(attachmentManager.getAttachment(any(), any())) .thenThrow(new AttachmentNotFoundException(ID)); @@ -152,7 +152,7 @@ public class StoreBlobManagerTest { } @Test - public void retrieveShouldThrowOnMailboxExceptionWhenRetrievingMessage() throws Exception { + void retrieveShouldThrowOnMailboxExceptionWhenRetrievingMessage() throws Exception { when(attachmentManager.getAttachment(any(), any())) .thenThrow(new AttachmentNotFoundException(ID)); @@ -164,7 +164,7 @@ public class StoreBlobManagerTest { } @Test - public void retrieveShouldThrowOnMailboxExceptionWhenRetrievingMessageContent() throws Exception { + void retrieveShouldThrowOnMailboxExceptionWhenRetrievingMessageContent() throws Exception { when(attachmentManager.getAttachment(any(), any())) .thenThrow(new AttachmentNotFoundException(ID)); @@ -178,7 +178,7 @@ public class StoreBlobManagerTest { } @Test - public void retrieveShouldThrowOnRuntimeExceptionWhenRetrievingMessageContent() throws Exception { + void retrieveShouldThrowOnRuntimeExceptionWhenRetrievingMessageContent() throws Exception { when(attachmentManager.getAttachment(any(), any())) .thenThrow(new AttachmentNotFoundException(ID)); @@ -192,7 +192,7 @@ public class StoreBlobManagerTest { } @Test - public void retrieveShouldThrowOnIOExceptionWhenRetrievingMessageContentInputStream() throws Exception { + void retrieveShouldThrowOnIOExceptionWhenRetrievingMessageContentInputStream() throws Exception { when(attachmentManager.getAttachment(any(), any())) .thenThrow(new AttachmentNotFoundException(ID)); @@ -208,7 +208,7 @@ public class StoreBlobManagerTest { } @Test - public void retrieveShouldThrowOnRuntimeExceptionWhenRetrievingMessageContentInputStream() throws Exception { + void retrieveShouldThrowOnRuntimeExceptionWhenRetrievingMessageContentInputStream() throws Exception { when(attachmentManager.getAttachment(any(), any())) .thenThrow(new AttachmentNotFoundException(ID)); @@ -224,7 +224,7 @@ public class StoreBlobManagerTest { } @Test - public void toBlobIdShouldReturnBlobIdCorrespondingToAMessageId() { + void toBlobIdShouldReturnBlobIdCorrespondingToAMessageId() { assertThat(blobManager.toBlobId(MESSAGE_ID)) .isEqualTo(BlobId.fromString("125")); } --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org