You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2021/06/16 04:11:58 UTC

[james-project] 01/02: JAMES-3516 Define MimeMessageId and Subject header fields POJOs

This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 473d9b6da5fc4658c2b155326e9ffa8278701a53
Author: quanth <hq...@linagora.com>
AuthorDate: Mon Jun 14 10:07:41 2021 +0700

    JAMES-3516 Define MimeMessageId and Subject header fields POJOs
---
 .../mailbox/store/mail/model/MimeMessageId.java    | 58 ++++++++++++++++++++++
 .../james/mailbox/store/mail/model/Subject.java    | 58 ++++++++++++++++++++++
 .../store/mail/model/MimeMessageIdTest.java        | 32 ++++++++++++
 .../mailbox/store/mail/model/SubjectTest.java      | 32 ++++++++++++
 4 files changed, 180 insertions(+)

diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MimeMessageId.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MimeMessageId.java
new file mode 100644
index 0000000..9e42f4d
--- /dev/null
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MimeMessageId.java
@@ -0,0 +1,58 @@
+/******************************************************************
+ * 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.mailbox.store.mail.model;
+
+import java.util.Objects;
+
+import com.google.common.base.MoreObjects;
+
+public class MimeMessageId {
+    private final String value;
+
+    public MimeMessageId(String value) {
+        this.value = value;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    @Override
+    public final boolean equals(Object o) {
+        if (o instanceof MimeMessageId) {
+            MimeMessageId that = (MimeMessageId) o;
+
+            return Objects.equals(this.value, that.value);
+        }
+        return false;
+    }
+
+    @Override
+    public final int hashCode() {
+        return Objects.hash(value);
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(this)
+            .add("value", value)
+            .toString();
+    }
+}
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/Subject.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/Subject.java
new file mode 100644
index 0000000..e0ff2c1
--- /dev/null
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/Subject.java
@@ -0,0 +1,58 @@
+/******************************************************************
+ * 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.mailbox.store.mail.model;
+
+import java.util.Objects;
+
+import com.google.common.base.MoreObjects;
+
+public class Subject {
+    private final String value;
+
+    public Subject(String value) {
+        this.value = value;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    @Override
+    public final boolean equals(Object o) {
+        if (o instanceof Subject) {
+            Subject that = (Subject) o;
+
+            return Objects.equals(this.value, that.value);
+        }
+        return false;
+    }
+
+    @Override
+    public final int hashCode() {
+        return Objects.hash(value);
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(this)
+            .add("value", value)
+            .toString();
+    }
+}
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MimeMessageIdTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MimeMessageIdTest.java
new file mode 100644
index 0000000..72ddf0d
--- /dev/null
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MimeMessageIdTest.java
@@ -0,0 +1,32 @@
+/******************************************************************
+ * 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.mailbox.store.mail.model;
+
+import org.junit.jupiter.api.Test;
+
+import nl.jqno.equalsverifier.EqualsVerifier;
+
+public class MimeMessageIdTest {
+    @Test
+    void shouldMatchBeanContract() {
+        EqualsVerifier.forClass(MimeMessageId.class)
+            .verify();
+    }
+}
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/SubjectTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/SubjectTest.java
new file mode 100644
index 0000000..4f746da
--- /dev/null
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/SubjectTest.java
@@ -0,0 +1,32 @@
+/******************************************************************
+ * 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.mailbox.store.mail.model;
+
+import org.junit.jupiter.api.Test;
+
+import nl.jqno.equalsverifier.EqualsVerifier;
+
+public class SubjectTest {
+    @Test
+    void shouldMatchBeanContract() {
+        EqualsVerifier.forClass(Subject.class)
+            .verify();
+    }
+}

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