From 4af89b3f90daa5cfe4d988f40f739b5148e09ea2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 25 Nov 2014 21:27:03 +0100 Subject: [PATCH] Override some methods from Object to provide better interoperability with tests. --- .../java/net/pterodactylus/sone/TestValue.java | 26 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) 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()); + } + } -- 2.7.4