Search in sources :

Example 6 with ChatText

use of com.bergerkiller.bukkit.common.wrappers.ChatText in project BKCommonLib by bergerhealer.

the class ChatTextTest method testSuffixStyle.

@Test
public void testSuffixStyle() {
    // Test that a String with a suffix chat style character preserves the style
    String msg = "Prefix" + ChatColor.RED.toString();
    ChatText text = ChatText.fromMessage(msg);
    assertEquals(msg, text.getMessage());
}
Also used : ChatText(com.bergerkiller.bukkit.common.wrappers.ChatText) Test(org.junit.Test)

Example 7 with ChatText

use of com.bergerkiller.bukkit.common.wrappers.ChatText in project BKCommonLib by bergerhealer.

the class ChatTextTest method testPrefixStyle.

@Test
public void testPrefixStyle() {
    // Test that a String with a prefix chat style character preserves the style
    String msg = ChatColor.RED.toString() + "Postfix";
    ChatText text = ChatText.fromMessage(msg);
    assertEquals(msg, text.getMessage());
}
Also used : ChatText(com.bergerkiller.bukkit.common.wrappers.ChatText) Test(org.junit.Test)

Example 8 with ChatText

use of com.bergerkiller.bukkit.common.wrappers.ChatText in project BKCommonLib by bergerhealer.

the class ChatTextTest method testNewlines.

@Test
public void testNewlines() {
    String message = "hello\nworld";
    ChatText text = ChatText.fromMessage(message);
    assertEquals(message, text.getMessage());
}
Also used : ChatText(com.bergerkiller.bukkit.common.wrappers.ChatText) Test(org.junit.Test)

Aggregations

ChatText (com.bergerkiller.bukkit.common.wrappers.ChatText)8 Test (org.junit.Test)7 HashSet (java.util.HashSet)2 CommonTagCompound (com.bergerkiller.bukkit.common.nbt.CommonTagCompound)1 PacketPlayOutUpdateSignHandle (com.bergerkiller.generated.net.minecraft.network.protocol.game.PacketPlayOutUpdateSignHandle)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 Ignore (org.junit.Ignore)1