✅ Add test for ClientHello
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 8 Feb 2023 12:41:49 +0000 (13:41 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 8 Feb 2023 12:41:49 +0000 (13:41 +0100)
src/test/java/net/pterodactylus/fcp/ClientHelloTest.java [new file with mode: 0644]

diff --git a/src/test/java/net/pterodactylus/fcp/ClientHelloTest.java b/src/test/java/net/pterodactylus/fcp/ClientHelloTest.java
new file mode 100644 (file)
index 0000000..5a0604d
--- /dev/null
@@ -0,0 +1,34 @@
+package net.pterodactylus.fcp;
+
+import net.pterodactylus.fcp.test.Matchers;
+
+import org.junit.Test;
+
+import static net.pterodactylus.fcp.test.Matchers.isMessage;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.hasItem;
+
+/**
+ * Unit test for {@link ClientHello}.
+ */
+public class ClientHelloTest {
+
+       @Test
+       public void canCreateNewClientHello() {
+               ClientHello clientHello = new ClientHello("test-client");
+               assertThat(clientHello, isMessage("ClientHello", hasItem("Name=test-client")));
+       }
+
+       @Test
+       public void clientHelloWithoutExpectedVersionHasDefaultExpectedVersion() {
+               ClientHello clientHello = new ClientHello("test-client");
+               assertThat(clientHello, isMessage("ClientHello", hasItem("ExpectedVersion=2.0")));
+       }
+
+       @Test
+       public void canCreateHelloWorldWithClientNameAndExpectedVersion() {
+               ClientHello clientHello = new ClientHello("test-client", "1.2.3");
+               assertThat(clientHello, isMessage("ClientHello", "Name=test-client", "ExpectedVersion=1.2.3"));
+       }
+
+}