From: David ‘Bombe’ Roden Date: Tue, 9 Jul 2019 08:22:32 +0000 (+0200) Subject: ✨ Add toString() implementation for Client X-Git-Tag: v81^2~199 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=955730bdb935c25945c3cdc9a2eff2f720e8aac0;p=Sone.git ✨ Add toString() implementation for Client --- diff --git a/src/main/java/net/pterodactylus/sone/data/Client.java b/src/main/java/net/pterodactylus/sone/data/Client.java index f23decf..7dd086d 100644 --- a/src/main/java/net/pterodactylus/sone/data/Client.java +++ b/src/main/java/net/pterodactylus/sone/data/Client.java @@ -81,4 +81,9 @@ public class Client { return Objects.hashCode(name, version); } + @Override + public String toString() { + return name + " " + version; + } + } diff --git a/src/test/kotlin/net/pterodactylus/sone/data/ClientTest.kt b/src/test/kotlin/net/pterodactylus/sone/data/ClientTest.kt new file mode 100644 index 0000000..bad8ff8 --- /dev/null +++ b/src/test/kotlin/net/pterodactylus/sone/data/ClientTest.kt @@ -0,0 +1,15 @@ +package net.pterodactylus.sone.data + +import org.hamcrest.MatcherAssert.* +import org.hamcrest.Matchers.* +import kotlin.test.* + +class ClientTest { + + @Test + fun `toString() formats client name and version`() { + val client = Client("Test Client", "v123") + assertThat(client.toString(), equalTo("Test Client v123")) + } + +}