james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [4/9] james-project git commit: JAMES-2544 MimeMessagePartsId should respect bean contract
Date Tue, 02 Oct 2018 02:57:06 GMT
JAMES-2544 MimeMessagePartsId should respect bean contract


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

Branch: refs/heads/master
Commit: 4f09634609fcc9aa6f22fcf339ed088562fd12bc
Parents: 34db715
Author: Antoine Duprat <aduprat@linagora.com>
Authored: Thu Sep 27 11:46:23 2018 +0200
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Tue Oct 2 09:20:42 2018 +0700

----------------------------------------------------------------------
 server/blob/mail-store/pom.xml                  |  5 +++
 .../james/blob/mail/MimeMessagePartsId.java     | 17 ++++++++++
 .../james/blob/mail/MimeMessagePartsIdTest.java | 33 ++++++++++++++++++++
 3 files changed, 55 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/4f096346/server/blob/mail-store/pom.xml
----------------------------------------------------------------------
diff --git a/server/blob/mail-store/pom.xml b/server/blob/mail-store/pom.xml
index 5622826..8d708f2 100644
--- a/server/blob/mail-store/pom.xml
+++ b/server/blob/mail-store/pom.xml
@@ -47,6 +47,11 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>nl.jqno.equalsverifier</groupId>
+            <artifactId>equalsverifier</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
         </dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/4f096346/server/blob/mail-store/src/main/java/org/apache/james/blob/mail/MimeMessagePartsId.java
----------------------------------------------------------------------
diff --git a/server/blob/mail-store/src/main/java/org/apache/james/blob/mail/MimeMessagePartsId.java
b/server/blob/mail-store/src/main/java/org/apache/james/blob/mail/MimeMessagePartsId.java
index 5d1c48c..7dc681a 100644
--- a/server/blob/mail-store/src/main/java/org/apache/james/blob/mail/MimeMessagePartsId.java
+++ b/server/blob/mail-store/src/main/java/org/apache/james/blob/mail/MimeMessagePartsId.java
@@ -20,6 +20,7 @@
 package org.apache.james.blob.mail;
 
 import java.util.Map;
+import java.util.Objects;
 
 import org.apache.james.blob.api.BlobId;
 import org.apache.james.blob.api.BlobPartsId;
@@ -99,4 +100,20 @@ public class MimeMessagePartsId implements BlobPartsId {
     public BlobId getBodyBlobId() {
         return bodyBlobId;
     }
+
+    @Override
+    public final boolean equals(Object o) {
+        if (o instanceof MimeMessagePartsId) {
+            MimeMessagePartsId that = (MimeMessagePartsId) o;
+
+            return Objects.equals(this.headerBlobId, that.headerBlobId)
+                && Objects.equals(this.bodyBlobId, that.bodyBlobId);
+        }
+        return false;
+    }
+
+    @Override
+    public final int hashCode() {
+        return Objects.hash(headerBlobId, bodyBlobId);
+    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/4f096346/server/blob/mail-store/src/test/java/org/apache/james/blob/mail/MimeMessagePartsIdTest.java
----------------------------------------------------------------------
diff --git a/server/blob/mail-store/src/test/java/org/apache/james/blob/mail/MimeMessagePartsIdTest.java
b/server/blob/mail-store/src/test/java/org/apache/james/blob/mail/MimeMessagePartsIdTest.java
new file mode 100644
index 0000000..a3091fb
--- /dev/null
+++ b/server/blob/mail-store/src/test/java/org/apache/james/blob/mail/MimeMessagePartsIdTest.java
@@ -0,0 +1,33 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.blob.mail;
+
+import org.junit.jupiter.api.Test;
+
+import nl.jqno.equalsverifier.EqualsVerifier;
+
+class MimeMessagePartsIdTest {
+
+    @Test
+    void shouldMatchBeanContract() {
+        EqualsVerifier.forClass(MimeMessagePartsId.class)
+            .verify();
+    }
+}
\ No newline at end of file


---------------------------------------------------------------------
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