From: David ‘Bombe’ Roden Date: Wed, 8 Feb 2023 12:41:49 +0000 (+0100) Subject: ✅ Add test for ClientHello X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=98fc8368ef5633560065b807b5676cd4f13e7649;p=jFCPlib.git ✅ Add test for ClientHello --- 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")); + } + +}