From: David ‘Bombe’ Roden Date: Tue, 25 Nov 2014 20:27:03 +0000 (+0100) Subject: Override some methods from Object to provide better interoperability with tests. X-Git-Tag: 0.9-rc1^2~3^2~15 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=4af89b3f90daa5cfe4d988f40f739b5148e09ea2;p=Sone.git Override some methods from Object to provide better interoperability with tests. --- diff --git a/src/test/java/net/pterodactylus/sone/TestValue.java b/src/test/java/net/pterodactylus/sone/TestValue.java index 4f3058b..dd923d3 100644 --- a/src/test/java/net/pterodactylus/sone/TestValue.java +++ b/src/test/java/net/pterodactylus/sone/TestValue.java @@ -5,11 +5,13 @@ import java.util.concurrent.atomic.AtomicReference; import net.pterodactylus.util.config.ConfigurationException; import net.pterodactylus.util.config.Value; +import com.google.common.base.Objects; + /** -* Simple {@link Value} implementation. -* -* @author David ‘Bombe’ Roden -*/ + * Simple {@link Value} implementation. + * + * @author David ‘Bombe’ Roden + */ public class TestValue implements Value { private final AtomicReference value = new AtomicReference(); @@ -34,4 +36,20 @@ public class TestValue implements Value { value.set(newValue); } + @Override + public int hashCode() { + return value.hashCode(); + } + + @Override + public boolean equals(Object obj) { + return (obj instanceof TestValue) && Objects.equal(value.get(), + ((TestValue) obj).value.get()); + } + + @Override + public String toString() { + return String.valueOf(value.get()); + } + }