use of at.pcgamingfreaks.Bungee.Message.Message in project Bukkit_Bungee_PluginLib by GeorgH93.
the class LanguageTest method testLanguage.
@Test
public void testLanguage() throws Exception {
Language language = new Language(TestObjects.getPlugin(), 1);
assertNotNull("The language object should not be null", language);
language = spy(language);
doReturn("TestText").when(language).get("test");
doReturn(new Message("MessageText")).when(language, at.pcgamingfreaks.Language.class.getDeclaredMethod("getMessage", boolean.class, String.class)).withArguments(true, "test");
assertEquals("The option string should match", "TestText", language.getString("test"));
assertEquals("The translated string should match", "TestText", language.getTranslated("test"));
assertEquals("The base component should be ready to send", 1, language.getReady("test").length);
assertEquals("The message should be equal", "TestText", language.getMessage("test").getClassicMessage());
}
use of at.pcgamingfreaks.Bungee.Message.Message in project Bukkit_Bungee_PluginLib by GeorgH93.
the class BossBarSenderTest method testBroadcast.
@Test
public void testBroadcast() throws NoSuchFieldException, IllegalAccessException {
TestObjects.initProxyServer();
int sendCalls = 0;
BossBarSender bossBarSender = new BossBarSender();
bossBarSender.doBroadcast("");
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
bossBarSender.doBroadcast("", 1);
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
BossBarSender.broadcast(new Message(""));
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
}
use of at.pcgamingfreaks.Bungee.Message.Message in project Bukkit_Bungee_PluginLib by GeorgH93.
the class ChatSenderTest method testSend.
@Test
public void testSend() {
List<ProxiedPlayer> players = new ArrayList<>();
players.add(TestObjects.getPlayer());
players.add(TestObjects.getPlayer());
int sendCalls = 0;
int playerCount = players.size();
ChatSender chatSender = new ChatSender();
chatSender.doSend(TestObjects.getPlayer(), "");
verify(TestObjects.getPlayer().unsafe(), times(++sendCalls)).sendPacket(any(Chat.class));
chatSender.doSend(TestObjects.getPlayer(), "", 1);
verify(TestObjects.getPlayer().unsafe(), times(++sendCalls)).sendPacket(any(Chat.class));
ChatSender.send(TestObjects.getPlayer(), new Message(""));
verify(TestObjects.getPlayer().unsafe(), times(++sendCalls)).sendPacket(any(Chat.class));
chatSender.doSend(players, "");
sendCalls += playerCount;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
chatSender.doSend(players, "", 1);
sendCalls += playerCount;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
ChatSender.send(players, new Message(""));
sendCalls += playerCount;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
}
use of at.pcgamingfreaks.Bungee.Message.Message in project Bukkit_Bungee_PluginLib by GeorgH93.
the class ChatSenderTest method testBroadcast.
@Test
public void testBroadcast() throws NoSuchFieldException, IllegalAccessException {
TestObjects.initProxyServer();
int sendCalls = 0;
int playerCount = TestObjects.getPlayers().size();
ChatSender chatSender = new ChatSender();
chatSender.doBroadcast("");
sendCalls += playerCount;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
chatSender.doBroadcast("", 1);
sendCalls += playerCount;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
ChatSender.broadcast(new Message(""));
sendCalls += playerCount;
verify(TestObjects.getPlayer().unsafe(), times(sendCalls)).sendPacket(any(Chat.class));
}
Aggregations