@Test public void testAppendJSON() { MessageBuilder messageBuilder = new MessageBuilder(); messageBuilder.appendJson("[test]"); //noinspection SpellCheckingInspection assertEquals("The message text should match", "§rtest§r", messageBuilder.getClassicMessage()); }
@Test public void testMessageBuilder() { List<MessageComponent> messageComponents = new ArrayList<>(); messageComponents.add(new MessageComponent()); assertNotNull( "The message builder should not be null", new MessageBuilder(messageComponents.get(0))); assertNotNull("The message builder should not be null", new MessageBuilder(messageComponents)); assertNotNull( "The message builder should not be null", new MessageBuilder("", MessageColor.BLUE)); assertNotNull( "The message builder should not be null", new MessageBuilder("", new ChatColor[] {ChatColor.BOLD})); assertNotNull("The message builder should not be null", MessageBuilder.fromJson("")); }
@Test @SuppressWarnings("SpellCheckingInspection") public void testTootltips() { MessageBuilder messageBuilder = new MessageBuilder("Test"); messageBuilder.achievementTooltip(Achievement.BREED_COW); assertTrue("The tooltip should match", messageBuilder.getJson().contains("BREED_COW")); messageBuilder.statisticTooltip(Statistic.BANNER_CLEANED); assertTrue("The tooltip should match", messageBuilder.getJson().contains("BANNER_CLEANED")); messageBuilder.statisticTooltip(Statistic.BREAK_ITEM, Material.ANVIL); assertTrue("The tooltip should match", messageBuilder.getJson().contains("ANVIL")); messageBuilder.statisticTooltip(Statistic.ENTITY_KILLED_BY, EntityType.ARROW); assertTrue("The tooltip should match", messageBuilder.getJson().contains("ARROW")); messageBuilder.itemTooltip(new ItemStack(Material.ACTIVATOR_RAIL, 10)); assertTrue("The tooltip should match", messageBuilder.getJson().contains("ACTIVATOR_RAIL")); }