More Unit tests
Change-Id: I32dd3851e490979621c4a5205c6e041dee900244
diff --git a/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/Match.java b/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/Match.java
index 804514c..5f707d6 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/Match.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/Match.java
@@ -108,12 +108,13 @@
return Objects.hash(matchAny, value);
}
+ @SuppressWarnings("unchecked")
@Override
public boolean equals(Object other) {
if (!(other instanceof Match)) {
return false;
}
- Match<T> that = (Match) other;
+ Match<T> that = (Match<T>) other;
return Objects.equals(this.matchAny, that.matchAny) &&
Objects.equals(this.value, that.value);
}
diff --git a/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/Result.java b/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/Result.java
index 548174a..856f706 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/Result.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/Result.java
@@ -15,6 +15,10 @@
*/
package org.onosproject.store.consistent.impl;
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+import java.util.Objects;
+
/**
* Result of a database update operation.
*
@@ -74,6 +78,7 @@
/**
* Returns the status of database update operation.
+ *
* @return database update status
*/
public Status status() {
@@ -82,10 +87,35 @@
/**
* Returns the return value for the update.
+ *
* @return value returned by database update. If the status is another
* other than Status.OK, this returns a null
*/
public V value() {
return value;
}
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value, status);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public boolean equals(Object other) {
+ if (!(other instanceof Result)) {
+ return false;
+ }
+ Result<V> that = (Result<V>) other;
+ return Objects.equals(this.value, that.value) &&
+ Objects.equals(this.status, that.status);
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("status", status)
+ .add("value", value)
+ .toString();
+ }
}
\ No newline at end of file