JAMES-2426 Use ZonedDateTime instead of Data

Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/f7b97417
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/f7b97417
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/f7b97417

Branch: refs/heads/master
Commit: f7b97417befff3cc08cbc78e972bcb7d74a9f139
Parents: 48729c7
Author: Matthieu Baechler <[email protected]>
Authored: Mon Jun 18 15:23:26 2018 +0200
Committer: Raphael Ouazana <[email protected]>
Committed: Wed Jun 27 16:36:12 2018 +0200

----------------------------------------------------------------------
 .../mailbox/backup/MailboxMessageFixture.java   | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/f7b97417/mailbox/backup/src/test/java/org/apache/james/mailbox/backup/MailboxMessageFixture.java
----------------------------------------------------------------------
diff --git 
a/mailbox/backup/src/test/java/org/apache/james/mailbox/backup/MailboxMessageFixture.java
 
b/mailbox/backup/src/test/java/org/apache/james/mailbox/backup/MailboxMessageFixture.java
index 3d46075..1894be9 100644
--- 
a/mailbox/backup/src/test/java/org/apache/james/mailbox/backup/MailboxMessageFixture.java
+++ 
b/mailbox/backup/src/test/java/org/apache/james/mailbox/backup/MailboxMessageFixture.java
@@ -21,8 +21,7 @@ package org.apache.james.mailbox.backup;
 
 import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
+import java.time.ZonedDateTime;
 import java.util.Date;
 
 import javax.mail.Flags;
@@ -36,10 +35,8 @@ import 
org.apache.james.mailbox.store.mail.model.impl.SimpleMailboxMessage;
 
 public interface MailboxMessageFixture {
 
-    SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd 
hh:mm:ss");
-
-    Date DATE_1 = parseDate("2018-02-15 15:54:02");
-    Date DATE_2 = parseDate("2018-03-15 15:54:02");
+    ZonedDateTime DATE_1 = ZonedDateTime.parse("2018-02-15T15:54:02Z");
+    ZonedDateTime DATE_2 = ZonedDateTime.parse("2018-03-15T15:54:02Z");
 
     MessageId.Factory MESSAGE_ID_FACTORY = new TestMessageId.Factory();
     Charset MESSAGE_CHARSET = StandardCharsets.UTF_8;
@@ -56,7 +53,7 @@ public interface MailboxMessageFixture {
         .messageId(MESSAGE_ID_1)
         .content(CONTENT_STREAM_1)
         .size(SIZE_1)
-        .internalDate(DATE_1)
+        .internalDate(new Date(DATE_1.toEpochSecond()))
         .bodyStartOctet(0)
         .flags(new Flags())
         .propertyBuilder(new PropertyBuilder())
@@ -66,18 +63,11 @@ public interface MailboxMessageFixture {
         .messageId(MESSAGE_ID_2)
         .content(CONTENT_STREAM_2)
         .size(SIZE_2)
-        .internalDate(DATE_2)
+        .internalDate(new Date(DATE_2.toEpochSecond()))
         .bodyStartOctet(0)
         .flags(new Flags())
         .propertyBuilder(new PropertyBuilder())
         .mailboxId(TestId.of(1L))
         .build();
 
-    static Date parseDate(String input) {
-        try {
-            return SIMPLE_DATE_FORMAT.parse(input);
-        } catch (ParseException e) {
-            throw new RuntimeException(e);
-        }
-    }
 }


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

Reply via email to