james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [2/2] james-project git commit: JAMES-2045 Add test on date head without century
Date Mon, 05 Jun 2017 10:01:47 GMT
JAMES-2045 Add test on date head without century


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

Branch: refs/heads/master
Commit: b9382c45c8037af2b22fd47aa9b0cf790a0de8ed
Parents: b432e3c
Author: Antoine Duprat <aduprat@linagora.com>
Authored: Fri Jun 2 15:30:51 2017 +0200
Committer: benwa <btellier@linagora.com>
Committed: Mon Jun 5 17:00:49 2017 +0700

----------------------------------------------------------------------
 .../james/jmap/model/MessageFactoryTest.java    | 26 ++++++++++++++++++++
 1 file changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/b9382c45/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MessageFactoryTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MessageFactoryTest.java
b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MessageFactoryTest.java
index cc65cc7..76e3cd5 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MessageFactoryTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/MessageFactoryTest.java
@@ -361,6 +361,32 @@ public class MessageFactoryTest {
     }
 
     @Test
+    public void dateFromHeaderShouldUseCurrentCenturyWhenNone() throws Exception {
+        String headers = "From: user <userdomain>\n"
+            + "To: user1 <user1domain>, user2 <user2domain>\n"
+            + "Cc: usercc <userccdomain>\n"
+            + "Bcc: userbcc <userbccdomain>\n"
+            + "Date: Wed, 17 May 17 14:18:52 +0300\n"
+            + "Subject: test subject\n";
+
+        MetaDataWithContent testMail = MetaDataWithContent.builder()
+            .uid(MessageUid.of(2))
+            .flags(new Flags(Flag.SEEN))
+            .size(headers.length())
+            .internalDate(INTERNAL_DATE)
+            .content(new ByteArrayInputStream(headers.getBytes(Charsets.UTF_8)))
+            .attachments(ImmutableList.of())
+            .mailboxId(MAILBOX_ID)
+            .messageId(new TestMessageId.Factory().generate())
+            .build();
+
+        Message testee = messageFactory.fromMetaDataWithContent(testMail);
+
+        assertThat(testee.getDate())
+            .isEqualTo(Instant.parse("2017-05-17T11:18:52.000Z"));
+    }
+
+    @Test
     public void internalDateShouldBeUsedIfNoDateInHeaders() throws Exception {
         String headers = "From: user <userdomain>\n"
             + "To: user1 <user1domain>, user2 <user2domain>\n"


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message