summaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-07-18 09:40:51 +1000
committermd_5 <git@md-5.net>2018-07-18 09:40:51 +1000
commita3b5ef2c3e07c86184f265f9a649b8d04729c95a (patch)
tree92d5297a770caa63a18da5d2013c7dc59008760a /src/test/java
parentd480dc74e5a6693695166ab2d53e80616ff56bb5 (diff)
downloadcraftbukkit-a3b5ef2c3e07c86184f265f9a649b8d04729c95a.tar
craftbukkit-a3b5ef2c3e07c86184f265f9a649b8d04729c95a.tar.gz
craftbukkit-a3b5ef2c3e07c86184f265f9a649b8d04729c95a.tar.lz
craftbukkit-a3b5ef2c3e07c86184f265f9a649b8d04729c95a.tar.xz
craftbukkit-a3b5ef2c3e07c86184f265f9a649b8d04729c95a.zip
Amend previous unit test to use JSON rather than toString for validation
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/bukkit/ChatTest.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/test/java/org/bukkit/ChatTest.java b/src/test/java/org/bukkit/ChatTest.java
index 41c4b045..0aa60d61 100644
--- a/src/test/java/org/bukkit/ChatTest.java
+++ b/src/test/java/org/bukkit/ChatTest.java
@@ -35,15 +35,15 @@ public class ChatTest {
public void testURLJsonConversion() {
IChatBaseComponent[] components;
components = CraftChatMessage.fromString("https://spigotmc.org/test Test Message");
- assertEquals("TextComponent{text='', siblings=[TextComponent{text='https://spigotmc.org/test', siblings=[], style=Style{hasParent=true, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=ClickEvent{action=OPEN_URL, value='https://spigotmc.org/test'}, hoverEvent=null, insertion=null}}, TextComponent{text=' Test Message', siblings=[], style=Style{hasParent=true, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}",
- components[0].toString());
+ assertEquals("{\"extra\":[{\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://spigotmc.org/test\"},\"text\":\"https://spigotmc.org/test\"},{\"text\":\" Test Message\"}],\"text\":\"\"}",
+ CraftChatMessage.toJSON(components[0]));
components = CraftChatMessage.fromString("123 " + ChatColor.GOLD + "https://spigotmc.org " + ChatColor.BOLD + "test");
- assertEquals("TextComponent{text='', siblings=[TextComponent{text='123 ', siblings=[], style=Style{hasParent=true, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}, TextComponent{text='https://spigotmc.org', siblings=[], style=Style{hasParent=true, color=§6, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=ClickEvent{action=OPEN_URL, value='https://spigotmc.org'}, hoverEvent=null, insertion=null}}, TextComponent{text=' ', siblings=[], style=Style{hasParent=true, color=§6, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}, TextComponent{text='test', siblings=[], style=Style{hasParent=true, color=§6, bold=true, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}",
- components[0].toString());
+ assertEquals("{\"extra\":[{\"text\":\"123 \"},{\"color\":\"gold\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://spigotmc.org\"},\"text\":\"https://spigotmc.org\"},{\"color\":\"gold\",\"text\":\" \"},{\"bold\":true,\"color\":\"gold\",\"text\":\"test\"}],\"text\":\"\"}",
+ CraftChatMessage.toJSON(components[0]));
components = CraftChatMessage.fromString("multiCase http://SpigotMC.ORg/SpOngeBobMeEMeGoESHeRE");
- assertEquals("TextComponent{text='', siblings=[TextComponent{text='multiCase ', siblings=[], style=Style{hasParent=true, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}, TextComponent{text='http://SpigotMC.ORg/SpOngeBobMeEMeGoESHeRE', siblings=[], style=Style{hasParent=true, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=ClickEvent{action=OPEN_URL, value='http://SpigotMC.ORg/SpOngeBobMeEMeGoESHeRE'}, hoverEvent=null, insertion=null}}], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}",
- components[0].toString());
+ assertEquals("{\"extra\":[{\"text\":\"multiCase \"},{\"clickEvent\":{\"action\":\"open_url\",\"value\":\"http://SpigotMC.ORg/SpOngeBobMeEMeGoESHeRE\"},\"text\":\"http://SpigotMC.ORg/SpOngeBobMeEMeGoESHeRE\"}],\"text\":\"\"}",
+ CraftChatMessage.toJSON(components[0]));
}
}