From d6e2f35efde4d97b9c2c6e552e14ab05a7c570c7 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Mon, 2 Oct 2017 09:03:30 +0200 Subject: [PATCH] Fix unit test #1344 --- .../java/fr/xephi/authme/listener/PlayerListenerTest.java | 6 ++++-- .../authme/settings/WelcomeMessageConfigurationTest.java | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/test/java/fr/xephi/authme/listener/PlayerListenerTest.java b/src/test/java/fr/xephi/authme/listener/PlayerListenerTest.java index 9470e272f..a4f84279c 100644 --- a/src/test/java/fr/xephi/authme/listener/PlayerListenerTest.java +++ b/src/test/java/fr/xephi/authme/listener/PlayerListenerTest.java @@ -805,18 +805,19 @@ public class PlayerListenerTest { Player player = mock(Player.class); given(player.getName()).willReturn("doooew"); given(player.getDisplayName()).willReturn("Displ"); + given(player.getPlayerListName()).willReturn("List"); String joinMsg = "The player joined"; PlayerJoinEvent event = new PlayerJoinEvent(player, joinMsg); given(settings.getProperty(RegistrationSettings.REMOVE_JOIN_MESSAGE)).willReturn(false); given(settings.getProperty(RegistrationSettings.CUSTOM_JOIN_MESSAGE)) - .willReturn("Hello {PLAYERNAME} (aka {DISPLAYNAME})"); + .willReturn("Hello {PLAYERNAME} (aka {DISPLAYNAME} / {PLAYERLISTNAME})"); given(settings.getProperty(RegistrationSettings.DELAY_JOIN_MESSAGE)).willReturn(false); // when listener.onJoinMessage(event); // then - assertThat(event.getJoinMessage(), equalTo("Hello doooew (aka Displ)")); + assertThat(event.getJoinMessage(), equalTo("Hello doooew (aka Displ / List)")); verifyZeroInteractions(joinMessageService); } @@ -826,6 +827,7 @@ public class PlayerListenerTest { Player player = mock(Player.class); given(player.getName()).willReturn("thename0"); given(player.getDisplayName()).willReturn("(not used)"); + given(player.getPlayerListName()).willReturn("listName"); String joinMsg = "The player joined"; PlayerJoinEvent event = new PlayerJoinEvent(player, joinMsg); given(settings.getProperty(RegistrationSettings.REMOVE_JOIN_MESSAGE)).willReturn(false); diff --git a/src/test/java/fr/xephi/authme/settings/WelcomeMessageConfigurationTest.java b/src/test/java/fr/xephi/authme/settings/WelcomeMessageConfigurationTest.java index 37a3386af..c650dd6f5 100644 --- a/src/test/java/fr/xephi/authme/settings/WelcomeMessageConfigurationTest.java +++ b/src/test/java/fr/xephi/authme/settings/WelcomeMessageConfigurationTest.java @@ -7,6 +7,7 @@ import fr.xephi.authme.TestHelper; import fr.xephi.authme.data.auth.PlayerCache; import fr.xephi.authme.initialization.DataFolder; import fr.xephi.authme.service.BukkitService; +import fr.xephi.authme.service.CommonService; import fr.xephi.authme.service.GeoIpService; import org.bukkit.Server; import org.bukkit.World; @@ -49,6 +50,8 @@ public class WelcomeMessageConfigurationTest { private GeoIpService geoIpService; @Mock private PlayerCache playerCache; + @Mock + private CommonService service; @DataFolder private File testPluginFolder;