You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ro...@apache.org on 2018/01/25 15:36:36 UTC
[03/14] james-project git commit: JAMES-2291 Provide a test BlobId
JAMES-2291 Provide a test BlobId
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/4fbc8f3d
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/4fbc8f3d
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/4fbc8f3d
Branch: refs/heads/master
Commit: 4fbc8f3d5e8a1509231dcc8b8c235ea54b307a8f
Parents: b9ee907
Author: benwa <bt...@linagora.com>
Authored: Wed Jan 24 11:48:33 2018 +0700
Committer: benwa <bt...@linagora.com>
Committed: Thu Jan 25 12:02:53 2018 +0700
----------------------------------------------------------------------
.../org/apache/james/blob/api/TestBlobId.java | 65 ++++++++++++++++++++
1 file changed, 65 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/4fbc8f3d/server/blob/blob-api/src/test/java/org/apache/james/blob/api/TestBlobId.java
----------------------------------------------------------------------
diff --git a/server/blob/blob-api/src/test/java/org/apache/james/blob/api/TestBlobId.java b/server/blob/blob-api/src/test/java/org/apache/james/blob/api/TestBlobId.java
new file mode 100644
index 0000000..19e6483
--- /dev/null
+++ b/server/blob/blob-api/src/test/java/org/apache/james/blob/api/TestBlobId.java
@@ -0,0 +1,65 @@
+/****************************************************************
+ * 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.api;
+
+import java.util.Objects;
+
+import org.apache.commons.lang3.NotImplementedException;
+
+public class TestBlobId implements BlobId {
+
+ public static class Factory implements BlobId.Factory {
+ @Override
+ public BlobId forPayload(byte[] payload) {
+ throw new NotImplementedException("Use from(String) instead");
+ }
+
+ @Override
+ public BlobId from(String id) {
+ return new TestBlobId(id);
+ }
+ }
+
+ private final String rawValue;
+
+ public TestBlobId(String rawValue) {
+ this.rawValue = rawValue;
+ }
+
+ @Override
+ public String asString() {
+ return rawValue;
+ }
+
+ @Override
+ public final boolean equals(Object o) {
+ if (o instanceof TestBlobId) {
+ TestBlobId that = (TestBlobId) o;
+
+ return Objects.equals(this.rawValue, that.rawValue);
+ }
+ return false;
+ }
+
+ @Override
+ public final int hashCode() {
+ return Objects.hash(rawValue);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org