JAMES-2578 test for `browsing should support mail with attributes`
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/f96114bf Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/f96114bf Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/f96114bf Branch: refs/heads/master Commit: f96114bf2a9f73985f1139340cdcd97bf2e07879 Parents: 6f6a7db Author: tran tien duc <dt...@linagora.com> Authored: Wed Nov 14 15:03:18 2018 +0700 Committer: Benoit Tellier <btell...@linagora.com> Committed: Thu Nov 15 09:07:26 2018 +0700 ---------------------------------------------------------------------- .../queue/api/ManageableMailQueueContract.java | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/f96114bf/server/queue/queue-api/src/test/java/org/apache/james/queue/api/ManageableMailQueueContract.java ---------------------------------------------------------------------- diff --git a/server/queue/queue-api/src/test/java/org/apache/james/queue/api/ManageableMailQueueContract.java b/server/queue/queue-api/src/test/java/org/apache/james/queue/api/ManageableMailQueueContract.java index 009b3a5..fd5572d 100644 --- a/server/queue/queue-api/src/test/java/org/apache/james/queue/api/ManageableMailQueueContract.java +++ b/server/queue/queue-api/src/test/java/org/apache/james/queue/api/ManageableMailQueueContract.java @@ -33,10 +33,12 @@ import static org.assertj.core.api.SoftAssertions.assertSoftly; import javax.mail.internet.MimeMessage; import org.apache.james.core.builder.MimeMessageBuilder; +import org.apache.mailet.Attribute; import org.apache.mailet.Mail; import org.apache.mailet.base.MailAddressFixture; import org.junit.jupiter.api.Test; +import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterators; public interface ManageableMailQueueContract extends MailQueueContract { @@ -446,6 +448,25 @@ public interface ManageableMailQueueContract extends MailQueueContract { } @Test + default void browseShouldReturnMailsWithAttributes() throws Exception { + ManageableMailQueue mailQueue = getManageableMailQueue(); + mailQueue.enQueue(defaultMail() + .attributes(ImmutableList.of( + Attribute.convertToAttribute("Attribute Name 1", "Attribute Value 1"), + Attribute.convertToAttribute("Attribute Name 2", "Attribute Value 2"))) + .name("mail with blob") + .build()); + + Mail mail = mailQueue.browse().next().getMail(); + assertSoftly(softly -> { + softly.assertThat(mail.getAttribute("Attribute Name 1")) + .isEqualTo("Attribute Value 1"); + softly.assertThat(mail.getAttribute("Attribute Name 2")) + .isEqualTo("Attribute Value 2"); + }); + } + + @Test default void browsingShouldNotAffectDequeue() throws Exception { enQueue(defaultMail() .name("name1") --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org