Repository: james-project
Updated Branches:
  refs/heads/master 4ca681621 -> 900fd9d36


JAMES-1900 Re-indent HeaderCollectionTest


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

Branch: refs/heads/master
Commit: ff33b0cfada9f17ce3217853ddc8c0ef6d608cf0
Parents: 4ca6816
Author: benwa <btell...@linagora.com>
Authored: Thu May 4 14:58:01 2017 +0700
Committer: benwa <btell...@linagora.com>
Committed: Thu May 4 16:36:58 2017 +0700

----------------------------------------------------------------------
 .../json/HeaderCollectionTest.java              | 93 ++++++++++++++++----
 1 file changed, 74 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/ff33b0cf/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/HeaderCollectionTest.java
----------------------------------------------------------------------
diff --git 
a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/HeaderCollectionTest.java
 
b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/HeaderCollectionTest.java
index dbea3c5..69ebc6f 100644
--- 
a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/HeaderCollectionTest.java
+++ 
b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/HeaderCollectionTest.java
@@ -31,14 +31,20 @@ public class HeaderCollectionTest {
 
     @Test
     public void simpleValueAddressHeaderShouldBeAddedToTheAddressSet() {
-        HeaderCollection headerCollection = HeaderCollection.builder().add(new 
FieldImpl("To", "btell...@linagora.com")).build();
+        HeaderCollection headerCollection = HeaderCollection.builder()
+            .add(new FieldImpl("To", "btell...@linagora.com"))
+            .build();
+
         assertThat(headerCollection.getToAddressSet())
             .containsOnly(new EMailer("btell...@linagora.com", 
"btell...@linagora.com"));
     }
 
     @Test
     public void comaSeparatedAddressShouldBeBothAddedToTheAddressSet() {
-        HeaderCollection headerCollection = HeaderCollection.builder().add(new 
FieldImpl("To", "btell...@linagora.com, be...@minet.net")).build();
+        HeaderCollection headerCollection = HeaderCollection.builder()
+            .add(new FieldImpl("To", "btell...@linagora.com, be...@minet.net"))
+            .build();
+
         assertThat(headerCollection.getToAddressSet())
             .containsOnly(
                 new EMailer("btell...@linagora.com", "btell...@linagora.com"),
@@ -47,7 +53,11 @@ public class HeaderCollectionTest {
 
     @Test
     public void addressesOfTwoFieldsHavingTheSameNameShouldBeMerged() {
-        HeaderCollection headerCollection = HeaderCollection.builder().add(new 
FieldImpl("To", "btell...@linagora.com")).add(new FieldImpl("To", 
"btell...@linagora.com, be...@minet.net")).build();
+        HeaderCollection headerCollection = HeaderCollection.builder()
+            .add(new FieldImpl("To", "btell...@linagora.com"))
+            .add(new FieldImpl("To", "btell...@linagora.com, be...@minet.net"))
+            .build();
+
         assertThat(headerCollection.getToAddressSet())
             .containsOnly(
                 new EMailer("btell...@linagora.com", "btell...@linagora.com"),
@@ -56,14 +66,20 @@ public class HeaderCollectionTest {
 
     @Test
     public void displayNamesShouldBeRetreived() {
-        HeaderCollection headerCollection = HeaderCollection.builder().add(new 
FieldImpl("To", "Christophe Hamerling <chamerl...@linagora.com>")).build();
+        HeaderCollection headerCollection = HeaderCollection.builder()
+            .add(new FieldImpl("To", "Christophe Hamerling 
<chamerl...@linagora.com>"))
+            .build();
+
         assertThat(headerCollection.getToAddressSet())
             .containsOnly(new EMailer("Christophe Hamerling", 
"chamerl...@linagora.com"));
     }
 
     @Test
     public void displayNamesShouldBeRetrievedWhenEncodedWord() {
-        HeaderCollection headerCollection = HeaderCollection.builder().add(new 
FieldImpl("From", "=?UTF-8?B?RnLDqWTDqXJpYyBNQVJUSU4=?= <fmar...@linagora.com>, 
Graham CROSMARIE <gcrosma...@linagora.com>")).build();
+        HeaderCollection headerCollection = HeaderCollection.builder()
+            .add(new FieldImpl("From", "=?UTF-8?B?RnLDqWTDqXJpYyBNQVJUSU4=?= 
<fmar...@linagora.com>, Graham CROSMARIE <gcrosma...@linagora.com>"))
+            .build();
+
         assertThat(headerCollection.getFromAddressSet())
             .extracting(EMailer::getName)
             .contains("Frédéric MARTIN");
@@ -71,7 +87,10 @@ public class HeaderCollectionTest {
 
     @Test
     public void addressWithTwoDisplayNamesOnTheSameFieldShouldBeRetrieved() {
-        HeaderCollection headerCollection = HeaderCollection.builder().add(new 
FieldImpl("From", "Christophe Hamerling <chamerl...@linagora.com>, Graham 
CROSMARIE <gcrosma...@linagora.com>")).build();
+        HeaderCollection headerCollection = HeaderCollection.builder()
+            .add(new FieldImpl("From", "Christophe Hamerling 
<chamerl...@linagora.com>, Graham CROSMARIE <gcrosma...@linagora.com>"))
+            .build();
+
         assertThat(headerCollection.getFromAddressSet())
             .containsOnly(new EMailer("Christophe Hamerling", 
"chamerl...@linagora.com"),
                 new EMailer("Graham CROSMARIE", "gcrosma...@linagora.com"));
@@ -80,7 +99,10 @@ public class HeaderCollectionTest {
 
     @Test
     public void mixingAddressWithDisplayNamesWithOthersShouldBeAllowed() {
-        HeaderCollection headerCollection = HeaderCollection.builder().add(new 
FieldImpl("To", "Christophe Hamerling <chamerl...@linagora.com>, 
gcrosma...@linagora.com")).build();
+        HeaderCollection headerCollection = HeaderCollection.builder()
+            .add(new FieldImpl("To", "Christophe Hamerling 
<chamerl...@linagora.com>, gcrosma...@linagora.com"))
+            .build();
+
         assertThat(headerCollection.getToAddressSet())
             .containsOnly(new EMailer("Christophe Hamerling", 
"chamerl...@linagora.com"),
                 new EMailer("gcrosma...@linagora.com", 
"gcrosma...@linagora.com"));
@@ -88,50 +110,71 @@ public class HeaderCollectionTest {
 
     @Test
     public void displayNamesShouldBeRetreivedOnCc() {
-        HeaderCollection headerCollection = HeaderCollection.builder().add(new 
FieldImpl("Cc", "Christophe Hamerling <chamerl...@linagora.com>")).build();
+        HeaderCollection headerCollection = HeaderCollection.builder()
+            .add(new FieldImpl("Cc", "Christophe Hamerling 
<chamerl...@linagora.com>"))
+            .build();
+
         assertThat(headerCollection.getCcAddressSet())
             .containsOnly(new EMailer("Christophe Hamerling", 
"chamerl...@linagora.com"));
     }
 
     @Test
     public void displayNamesShouldBeRetreivedOnReplyTo() {
-        HeaderCollection headerCollection = HeaderCollection.builder().add(new 
FieldImpl("Reply-To", "Christophe Hamerling 
<chamerl...@linagora.com>")).build();
+        HeaderCollection headerCollection = HeaderCollection.builder()
+            .add(new FieldImpl("Reply-To", "Christophe Hamerling 
<chamerl...@linagora.com>"))
+            .build();
+
         assertThat(headerCollection.getReplyToAddressSet())
             .containsOnly(new EMailer("Christophe Hamerling", 
"chamerl...@linagora.com"));
     }
 
     @Test
     public void displayNamesShouldBeRetreivedOnBcc() {
-        HeaderCollection headerCollection = HeaderCollection.builder().add(new 
FieldImpl("Bcc", "Christophe Hamerling <chamerl...@linagora.com>")).build();
+        HeaderCollection headerCollection = HeaderCollection.builder()
+            .add(new FieldImpl("Bcc", "Christophe Hamerling 
<chamerl...@linagora.com>"))
+            .build();
+
         assertThat(headerCollection.getBccAddressSet())
             .containsOnly(new EMailer("Christophe Hamerling", 
"chamerl...@linagora.com"));
     }
 
     @Test
     public void 
headerContaingNoAddressShouldBeConsideredBothAsNameAndAddress() {
-        HeaderCollection headerCollection = HeaderCollection.builder().add(new 
FieldImpl("Bcc", "Not an address")).build();
+        HeaderCollection headerCollection = HeaderCollection.builder()
+            .add(new FieldImpl("Bcc", "Not an address"))
+            .build();
+
         assertThat(headerCollection.getBccAddressSet())
             .containsOnly(new EMailer("Not an address", "Not an address"));
     }
 
     @Test
     public void unclosedAddressSubpartShouldBeWellHandled() {
-        HeaderCollection headerCollection = HeaderCollection.builder().add(new 
FieldImpl("Bcc", "Mickey <tri...@mouse.com")).build();
+        HeaderCollection headerCollection = HeaderCollection.builder()
+            .add(new FieldImpl("Bcc", "Mickey <tri...@mouse.com"))
+            .build();
+
         assertThat(headerCollection.getBccAddressSet())
             .containsOnly(new EMailer("Mickey", "tri...@mouse.com"));
     }
 
     @Test
     public void notComaSeparatedAddressSubpartShouldBeWellHandled() {
-        HeaderCollection headerCollection = HeaderCollection.builder().add(new 
FieldImpl("Bcc", "Mickey <tri...@mouse.com> Miny<he...@polo.com>")).build();
+        HeaderCollection headerCollection = HeaderCollection.builder()
+            .add(new FieldImpl("Bcc", "Mickey <tri...@mouse.com> 
Miny<he...@polo.com>"))
+            .build();
+
         assertThat(headerCollection.getBccAddressSet())
             .containsOnly(new EMailer("Mickey", "tri...@mouse.com"),
                 new EMailer("Miny", "he...@polo.com"));
     }
 
     @Test
-    public void notSeparatedAddressSubpartShouldBeWellHandled1() {
-        HeaderCollection headerCollection = HeaderCollection.builder().add(new 
FieldImpl("Bcc", "Mickey <tri...@mouse.com>Miny<he...@polo.com>")).build();
+    public void notSeparatedAddressSubpartShouldBeWellHandled() {
+        HeaderCollection headerCollection = HeaderCollection.builder()
+            .add(new FieldImpl("Bcc", "Mickey 
<tri...@mouse.com>Miny<he...@polo.com>"))
+            .build();
+
         assertThat(headerCollection.getBccAddressSet())
             .containsOnly(new EMailer("Mickey", "tri...@mouse.com"),
                 new EMailer("Miny", "he...@polo.com"));
@@ -139,21 +182,30 @@ public class HeaderCollectionTest {
 
     @Test
     public void dateShouldBeRetreived() {
-        HeaderCollection headerCollection = HeaderCollection.builder().add(new 
FieldImpl("Date", "Thu, 4 Jun 2015 06:08:41 +0200")).build();
+        HeaderCollection headerCollection = HeaderCollection.builder()
+            .add(new FieldImpl("Date", "Thu, 4 Jun 2015 06:08:41 +0200"))
+            .build();
+
         
assertThat(DATE_TIME_FORMATTER.format(headerCollection.getSentDate().get()))
             .isEqualTo("2015/06/04 06:08:41");
     }
 
     @Test
     public void nonStandardDatesShouldBeRetreived() {
-        HeaderCollection headerCollection = HeaderCollection.builder().add(new 
FieldImpl("Date", "Thu, 4 Jun 2015 06:08:41 +0200 (UTC)")).build();
+        HeaderCollection headerCollection = HeaderCollection.builder()
+            .add(new FieldImpl("Date", "Thu, 4 Jun 2015 06:08:41 +0200 (UTC)"))
+            .build();
+
         
assertThat(DATE_TIME_FORMATTER.format(headerCollection.getSentDate().get()))
             .isEqualTo("2015/06/04 06:08:41");
     }
 
     @Test
     public void dateShouldBeAbsentOnInvalidHeader() {
-        HeaderCollection headerCollection = HeaderCollection.builder().add(new 
FieldImpl("Date", "Not a date")).build();
+        HeaderCollection headerCollection = HeaderCollection.builder()
+            .add(new FieldImpl("Date", "Not a date"))
+            .build();
+
         assertThat(headerCollection.getSentDate().isPresent())
             .isFalse();
     }
@@ -161,7 +213,10 @@ public class HeaderCollectionTest {
     @Test
     public void subjectsShouldBeWellRetrieved() {
         String subject = "A fantastic ElasticSearch module will be available 
soon for JAMES";
-        HeaderCollection headerCollection = HeaderCollection.builder().add(new 
FieldImpl("Subject", subject)).build();
+        HeaderCollection headerCollection = HeaderCollection.builder()
+            .add(new FieldImpl("Subject", subject))
+            .build();
+
         assertThat(headerCollection.getSubjectSet()).containsOnly("A fantastic 
ElasticSearch module will be available soon for JAMES");
     }
 


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

Reply via email to