Search in sources :

Example 1 with Node

use of net.kyori.adventure.text.minimessage.tree.Node in project adventure by KyoriPowered.

the class MiniMessageParserTest method testTreeOutput.

@Test
void testTreeOutput() {
    final String input = "<red> RED <blue> <name> <click:open_url:https://github.com> good <action> </click>";
    final TagResolver resolver = TagResolver.resolver(Placeholder.parsed("name", "you"), Placeholder.component("action", Component.text("click")));
    final Node tree = MiniMessage.miniMessage().deserializeToTree(input, resolver);
    final String expected = "Node {\n" + "  TagNode('red') {\n" + "    TextNode(' RED ')\n" + "    TagNode('blue') {\n" + "      TextNode(' you ')\n" + "      TagNode('click', 'open_url', 'https://github.com') {\n" + "        TextNode(' good ')\n" + "        TagNode('action') {\n" + "        }\n" + "        TextNode(' ')\n" + "      }\n" + "    }\n" + "  }\n" + "}\n";
    assertEquals(expected, tree.toString());
}
Also used : Node(net.kyori.adventure.text.minimessage.tree.Node) TagResolver(net.kyori.adventure.text.minimessage.tag.resolver.TagResolver) Test(org.junit.jupiter.api.Test)

Aggregations

TagResolver (net.kyori.adventure.text.minimessage.tag.resolver.TagResolver)1 Node (net.kyori.adventure.text.minimessage.tree.Node)1 Test (org.junit.jupiter.api.Test)1