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 a7a65461e41ca3d1feffe442916eda3a023e367d
Author: LanKhuat <[email protected]>
AuthorDate: Tue Oct 6 16:35:10 2020 +0700

    JAMES-3382 Email/query limit & position integration test fix
---
 .../contract/EmailQueryMethodContract.scala        | 36 ++++++++++++++--------
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git 
a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailQueryMethodContract.scala
 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailQueryMethodContract.scala
index ea20688..33c53b3 100644
--- 
a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailQueryMethodContract.scala
+++ 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailQueryMethodContract.scala
@@ -3176,33 +3176,43 @@ trait EmailQueryMethodContract {
 
   @Test
   def shouldLimitResultByLimitAndPosition(server: GuiceJamesServer): Unit = {
+    val mailboxProbe: MailboxProbeImpl = 
server.getProbe(classOf[MailboxProbeImpl])
+
     val message: Message = Message.Builder
       .of
       .setSubject("test")
       .setBody("testmail", StandardCharsets.UTF_8)
       .build
-    
server.getProbe(classOf[MailboxProbeImpl]).createMailbox(MailboxPath.inbox(BOB))
-    val otherMailboxPath = MailboxPath.forUser(BOB, "other")
-    val requestDate = Date.from(ZonedDateTime.now().minusDays(1).toInstant)
-    sendMessageToBobInbox(server, message, Date.from(requestDate.toInstant))
+    mailboxProbe.createMailbox(MailboxPath.inbox(BOB))
 
-    server.getProbe(classOf[MailboxProbeImpl]).createMailbox(otherMailboxPath)
-    val messageId2: MessageId = server.getProbe(classOf[MailboxProbeImpl])
-      .appendMessage(BOB.asString, otherMailboxPath, 
AppendCommand.from(message))
+    val otherMailboxPath = MailboxPath.forUser(BOB, "other")
+    mailboxProbe.createMailbox(otherMailboxPath)
+    server.getProbe(classOf[MailboxProbeImpl])
+      .appendMessage(BOB.asString, otherMailboxPath, AppendCommand.builder()
+        
.withInternalDate(Date.from(ZonedDateTime.now().minusDays(4).toInstant))
+        .build(message))
       .getMessageId
 
-    val messageId3: MessageId = server.getProbe(classOf[MailboxProbeImpl])
-      .appendMessage(BOB.asString, otherMailboxPath, 
AppendCommand.from(message))
+    val messageId2: MessageId = mailboxProbe
+      .appendMessage(BOB.asString, otherMailboxPath, AppendCommand.builder()
+        
.withInternalDate(Date.from(ZonedDateTime.now().minusDays(3).toInstant))
+        .build(message))
       .getMessageId
 
-    server.getProbe(classOf[MailboxProbeImpl])
-      .appendMessage(BOB.asString, otherMailboxPath, 
AppendCommand.from(message))
+    val messageId3: MessageId = mailboxProbe
+      .appendMessage(BOB.asString, otherMailboxPath, AppendCommand.builder()
+        
.withInternalDate(Date.from(ZonedDateTime.now().minusDays(2).toInstant))
+        .build(message))
       .getMessageId
 
-    server.getProbe(classOf[MailboxProbeImpl])
-      .appendMessage(BOB.asString, otherMailboxPath, 
AppendCommand.from(message))
+    mailboxProbe
+      .appendMessage(BOB.asString, otherMailboxPath, AppendCommand.builder()
+        
.withInternalDate(Date.from(ZonedDateTime.now().minusDays(1).toInstant))
+        .build(message))
       .getMessageId
 
+    sendMessageToBobInbox(server, message, 
Date.from(Date.from(ZonedDateTime.now().toInstant).toInstant))
+
     val request =
       s"""{
          |  "using": [


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

Reply via email to