From 98fc8368ef5633560065b807b5676cd4f13e7649 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 8 Feb 2023 13:41:49 +0100 Subject: [PATCH] =?utf8?q?=E2=9C=85=20Add=20test=20for=20ClientHello?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../net/pterodactylus/fcp/ClientHelloTest.java | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/test/java/net/pterodactylus/fcp/ClientHelloTest.java diff --git a/src/test/java/net/pterodactylus/fcp/ClientHelloTest.java b/src/test/java/net/pterodactylus/fcp/ClientHelloTest.java new file mode 100644 index 0000000..5a0604d --- /dev/null +++ b/src/test/java/net/pterodactylus/fcp/ClientHelloTest.java @@ -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")); + } + +} -- 2.7.4