Added another unit test + formatted code
This commit is contained in:
parent
70bb3ddcce
commit
bc746a546f
@ -11,7 +11,8 @@ import org.junit.Test;
|
|||||||
public class ComponentsTest
|
public class ComponentsTest
|
||||||
{
|
{
|
||||||
@Test
|
@Test
|
||||||
public void testBasicComponent() {
|
public void testBasicComponent()
|
||||||
|
{
|
||||||
TextComponent textComponent = new TextComponent( "Hello world" );
|
TextComponent textComponent = new TextComponent( "Hello world" );
|
||||||
textComponent.setColor( ChatColor.RED );
|
textComponent.setColor( ChatColor.RED );
|
||||||
|
|
||||||
@ -20,7 +21,8 @@ public class ComponentsTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLegacyConverter() {
|
public void testLegacyConverter()
|
||||||
|
{
|
||||||
BaseComponent[] test1 = TextComponent.fromLegacyText( ChatColor.AQUA + "Aqua " + ChatColor.RED + ChatColor.BOLD + "RedBold" );
|
BaseComponent[] test1 = TextComponent.fromLegacyText( ChatColor.AQUA + "Aqua " + ChatColor.RED + ChatColor.BOLD + "RedBold" );
|
||||||
|
|
||||||
Assert.assertEquals( "Aqua RedBold", BaseComponent.toPlainText( test1 ) );
|
Assert.assertEquals( "Aqua RedBold", BaseComponent.toPlainText( test1 ) );
|
||||||
@ -45,7 +47,8 @@ public class ComponentsTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTranslateComponent() {
|
public void testTranslateComponent()
|
||||||
|
{
|
||||||
TranslatableComponent item = new TranslatableComponent( "item.swordGold.name" );
|
TranslatableComponent item = new TranslatableComponent( "item.swordGold.name" );
|
||||||
item.setColor( ChatColor.AQUA );
|
item.setColor( ChatColor.AQUA );
|
||||||
TranslatableComponent translatableComponent = new TranslatableComponent( "commands.give.success",
|
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
|
Assert.assertEquals( ChatColor.WHITE + "Given " + ChatColor.AQUA + "Golden Sword" + ChatColor.WHITE
|
||||||
+ " * " + ChatColor.WHITE + "5" + ChatColor.WHITE + " to " + ChatColor.WHITE + "thinkofdeath",
|
+ " * " + ChatColor.WHITE + "5" + ChatColor.WHITE + " to " + ChatColor.WHITE + "thinkofdeath",
|
||||||
translatableComponent.toLegacyText() );
|
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() );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user