Added another unit test + formatted code

This commit is contained in:
Thinkofdeath 2013-12-08 10:17:02 +00:00
parent 70bb3ddcce
commit bc746a546f

View File

@ -11,7 +11,8 @@ import org.junit.Test;
public class ComponentsTest
{
@Test
public void testBasicComponent() {
public void testBasicComponent()
{
TextComponent textComponent = new TextComponent( "Hello world" );
textComponent.setColor( ChatColor.RED );
@ -20,7 +21,8 @@ public class ComponentsTest
}
@Test
public void testLegacyConverter() {
public void testLegacyConverter()
{
BaseComponent[] test1 = TextComponent.fromLegacyText( ChatColor.AQUA + "Aqua " + ChatColor.RED + ChatColor.BOLD + "RedBold" );
Assert.assertEquals( "Aqua RedBold", BaseComponent.toPlainText( test1 ) );
@ -45,7 +47,8 @@ public class ComponentsTest
}
@Test
public void testTranslateComponent() {
public void testTranslateComponent()
{
TranslatableComponent item = new TranslatableComponent( "item.swordGold.name" );
item.setColor( ChatColor.AQUA );
TranslatableComponent translatableComponent = new TranslatableComponent( "commands.give.success",
@ -56,5 +59,11 @@ public class ComponentsTest
Assert.assertEquals( ChatColor.WHITE + "Given " + ChatColor.AQUA + "Golden Sword" + ChatColor.WHITE
+ " * " + ChatColor.WHITE + "5" + ChatColor.WHITE + " to " + ChatColor.WHITE + "thinkofdeath",
translatableComponent.toLegacyText() );
TranslatableComponent positional = new TranslatableComponent( "book.pageIndicator", "5", "50" );
Assert.assertEquals( "Page 5 of 50", positional.toPlainText() );
Assert.assertEquals( ChatColor.WHITE + "Page " + ChatColor.WHITE + "5" + ChatColor.WHITE + " of " + ChatColor.WHITE + "50", positional.toLegacyText() );
}
}