From: David ‘Bombe’ Roden Date: Tue, 7 Jan 2025 06:45:14 +0000 (+0100) Subject: ✅ Add test for WatchGlobal X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=1f508e3c31b4142b66cf2ca31acada9f01f79c71;p=jFCPlib.git ✅ Add test for WatchGlobal --- diff --git a/src/test/java/net/pterodactylus/fcp/WatchGlobalTest.java b/src/test/java/net/pterodactylus/fcp/WatchGlobalTest.java new file mode 100644 index 0000000..41cdecc --- /dev/null +++ b/src/test/java/net/pterodactylus/fcp/WatchGlobalTest.java @@ -0,0 +1,48 @@ +package net.pterodactylus.fcp; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalTo; + +public class WatchGlobalTest { + + @Test + public void watchGlobalMessageWithOneArgumentHasCorrectName() { + WatchGlobal watchGlobal = new WatchGlobal(true); + assertThat(watchGlobal.getName(), equalTo("WatchGlobal")); + } + + @Test + public void watchGlobalMessageWithOneArgumentTrueHasEnabledFieldSetToTrue() { + WatchGlobal watchGlobal = new WatchGlobal(true); + assertThat(watchGlobal.getField("Enabled"), equalTo("true")); + } + + @Test + public void watchGlobalMessageWithOneArgumentFalseHasEnabledFieldSetToFalse() { + WatchGlobal watchGlobal = new WatchGlobal(false); + assertThat(watchGlobal.getField("Enabled"), equalTo("false")); + } + + @Test + public void watchGlobalMessageWithTwoArgumentsHasCorrectName() { + WatchGlobal watchGlobal = new WatchGlobal(true, Verbosity.ALL); + assertThat(watchGlobal.getName(), equalTo("WatchGlobal")); + } + + @Test + public void watchGlobalMessageWithTwoArgumentsTrueAndAllHasTheCorrectFieldsSet() { + WatchGlobal watchGlobal = new WatchGlobal(true, Verbosity.ALL); + assertThat(watchGlobal.getField("Enabled"), equalTo("true")); + assertThat(watchGlobal.getField("VerbosityMask"), equalTo("-1")); + } + + @Test + public void watchGlobalMessageWithTwoArgumentsFalseAndCompressionHasTheCorrectFieldsSet() { + WatchGlobal watchGlobal = new WatchGlobal(false, Verbosity.COMPRESSION); + assertThat(watchGlobal.getField("Enabled"), equalTo("false")); + assertThat(watchGlobal.getField("VerbosityMask"), equalTo("512")); + } + +}