### Question:
WelcomeMessageConfiguration implements Reloadable { public List<String> getWelcomeMessage(Player player) { return messageSupplier.getAdaptedMessages(player); }  @PostConstruct @Override void reload(); List<String> getWelcomeMessage(Player player); void sendWelcomeMessage(Player player);  }### Answer:
@Test public void shouldApplyOtherReplacements() throws IOException { String welcomeMessage = "{ONLINE}/{MAXPLAYERS} online\n{LOGINS} logged in\nYour world is {WORLD}\nServer: {VERSION}"; setWelcomeMessageAndReload(welcomeMessage); given(bukkitService.getOnlinePlayers()).willReturn((List) Arrays.asList(mock(Player.class), mock(Player.class))); given(server.getMaxPlayers()).willReturn(20); given(playerCache.getLogged()).willReturn(1); given(server.getBukkitVersion()).willReturn("Bukkit-456.77.8"); World world = mock(World.class); given(world.getName()).willReturn("Hub"); Player player = mock(Player.class); given(player.getWorld()).willReturn(world); List<String> result = welcomeMessageConfiguration.getWelcomeMessage(player); assertThat(result, hasSize(4)); assertThat(result.get(0), equalTo("2/20 online")); assertThat(result.get(1), equalTo("1 logged in")); assertThat(result.get(2), equalTo("Your world is Hub")); assertThat(result.get(3), equalTo("Server: Bukkit-456.77.8")); }
@Test public void shouldLoadWelcomeMessage() throws IOException { String welcomeMessage = "This is my welcome message for testing\nBye!"; setWelcomeMessageAndReload(welcomeMessage); Player player = mock(Player.class); List<String> result = welcomeMessageConfiguration.getWelcomeMessage(player); assertThat(result, hasSize(2)); assertThat(result, contains(welcomeMessage.split("\\n"))); verifyZeroInteractions(player, playerCache, geoIpService, bukkitService, server); }
@Test public void shouldReplaceNameAndIpAndCountry() throws IOException { String welcomeMessage = "Hello {PLAYER}, your IP is {IP}\nYour country is {COUNTRY}.\nWelcome to {SERVER}!"; setWelcomeMessageAndReload(welcomeMessage); Player player = mock(Player.class); given(player.getName()).willReturn("Bobby"); TestHelper.mockPlayerIp(player, "123.45.66.77"); given(geoIpService.getCountryName("123.45.66.77")).willReturn("Syldavia"); given(server.getServerName()).willReturn("CrazyServer"); List<String> result = welcomeMessageConfiguration.getWelcomeMessage(player); assertThat(result, hasSize(3)); assertThat(result.get(0), equalTo("Hello Bobby, your IP is 123.45.66.77")); assertThat(result.get(1), equalTo("Your country is Syldavia.")); assertThat(result.get(2), equalTo("Welcome to CrazyServer!")); verify(server, only()).getServerName(); verifyZeroInteractions(playerCache); }