From 51c3e1dec6a34dc5c87981e1b021d78be0e189c6 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Thu, 17 Aug 2017 17:31:17 +0200 Subject: [PATCH] Added /lenny and made tests optional + a fix --- pom.xml | 18 ++++++++++++++- .../commands/appendtext/LennyCommand.java | 18 +++++++++++++++ ...{ChatFormatTest.java => ChatFormatIT.java} | 23 +++++++++---------- 3 files changed, 46 insertions(+), 13 deletions(-) create mode 100644 src/main/java/buttondevteam/chat/commands/appendtext/LennyCommand.java rename src/test/java/buttondevteam/chat/{ChatFormatTest.java => ChatFormatIT.java} (74%) diff --git a/pom.xml b/pom.xml index b3918e0..e093f58 100644 --- a/pom.xml +++ b/pom.xml @@ -82,6 +82,22 @@ + + org.apache.maven.plugins + maven-failsafe-plugin + 2.12.4 + + + + integration-test + verify + + + + + true + + buttondevteam @@ -121,7 +137,7 @@ org.spigotmc spigot-api - 1.12-R0.1-SNAPSHOT + 1.12.1-R0.1-SNAPSHOT com.github.TBMCPlugins.ButtonCore diff --git a/src/main/java/buttondevteam/chat/commands/appendtext/LennyCommand.java b/src/main/java/buttondevteam/chat/commands/appendtext/LennyCommand.java new file mode 100644 index 0000000..c106f4a --- /dev/null +++ b/src/main/java/buttondevteam/chat/commands/appendtext/LennyCommand.java @@ -0,0 +1,18 @@ +package buttondevteam.chat.commands.appendtext; + +public final class LennyCommand extends AppendTextCommandBase { + + @Override + public String[] GetHelpText(String alias) { + return new String[] { "§6---- Lenny ----", // + "This command appends a Lenny face after your message", // + "Or just sends ne", // + "Use either /" + alias + " or just /" + alias }; // + } + + @Override + public String GetAppendedText() { + return "( ͡° ͜ʖ ͡°)"; + } + +} diff --git a/src/test/java/buttondevteam/chat/ChatFormatTest.java b/src/test/java/buttondevteam/chat/ChatFormatIT.java similarity index 74% rename from src/test/java/buttondevteam/chat/ChatFormatTest.java rename to src/test/java/buttondevteam/chat/ChatFormatIT.java index 9e97bf0..19c8f59 100644 --- a/src/test/java/buttondevteam/chat/ChatFormatTest.java +++ b/src/test/java/buttondevteam/chat/ChatFormatIT.java @@ -21,7 +21,7 @@ import buttondevteam.lib.chat.Color; import junit.framework.TestCase; @RunWith(ObjectTestRunner.class) -public class ChatFormatTest extends TestCase { +public class ChatFormatIT extends TestCase { @Objects public static List data() { TestPrepare.PrepareServer(); @@ -30,18 +30,18 @@ public class ChatFormatTest extends TestCase { List list = new ArrayList(); - list.add(new ChatFormatTest(sender, "*test*", new TellrawPart("test").setItalic(true).setColor(Color.White))); - list.add(new ChatFormatTest(sender, "**test**", new TellrawPart("test").setBold(true).setColor(Color.White))); - list.add(new ChatFormatTest(sender, "***test***", + list.add(new ChatFormatIT(sender, "*test*", new TellrawPart("test").setItalic(true).setColor(Color.White))); + list.add(new ChatFormatIT(sender, "**test**", new TellrawPart("test").setBold(true).setColor(Color.White))); + list.add(new ChatFormatIT(sender, "***test***", new TellrawPart("test").setBold(true).setItalic(true).setColor(Color.White))); - list.add(new ChatFormatTest(sender, "***_test_***", + list.add(new ChatFormatIT(sender, "***_test_***", new TellrawPart("test").setBold(true).setItalic(true).setUnderlined(true).setColor(Color.White))); - list.add(new ChatFormatTest(sender, "***_~~test~~_***", new TellrawPart("test").setBold(true).setItalic(true) + list.add(new ChatFormatIT(sender, "***_~~test~~_***", new TellrawPart("test").setBold(true).setItalic(true) .setUnderlined(true).setStrikethrough(true).setColor(Color.White))); - list.add(new ChatFormatTest(sender, "¯\\\\\\_(ツ)\\_/¯", new TellrawPart("¯").setColor(Color.White), + list.add(new ChatFormatIT(sender, "¯\\\\\\_(ツ)\\_/¯", new TellrawPart("¯").setColor(Color.White), new TellrawPart("\\").setColor(Color.White), new TellrawPart("_(ツ)").setColor(Color.White), new TellrawPart("_/¯").setColor(Color.White))); - list.add(new ChatFormatTest(sender, "https://google.hu/", + list.add(new ChatFormatIT(sender, "https://google.hu/", new TellrawPart("https://google.hu/").setColor(Color.White).setUnderlined(true) .setHoverEvent(TellrawEvent.create(HoverAction.SHOW_TEXT, new TellrawPart("Click to open").setColor(Color.Blue))) @@ -54,7 +54,7 @@ public class ChatFormatTest extends TestCase { private final String message; private final TellrawPart[] extras; - public ChatFormatTest(CommandSender sender, String message, TellrawPart... expectedextras) { + public ChatFormatIT(CommandSender sender, String message, TellrawPart... expectedextras) { this.sender = sender; this.message = message; this.extras = expectedextras; @@ -62,7 +62,7 @@ public class ChatFormatTest extends TestCase { @Test public void testMessage() { - /*ArrayList cfs = ChatProcessing.addFormatters(Color.White); + ArrayList cfs = ChatProcessing.addFormatters(Color.White); final String chid = ChatProcessing.getChannelID(Channel.GlobalChat, sender, null); final TellrawPart tp = ChatProcessing.createTellraw(sender, message, null, null, chid); ChatFormatter.Combine(cfs, message, tp); @@ -72,7 +72,6 @@ public class ChatFormatTest extends TestCase { // System.out.println("Raw: " + ChatProcessing.toJson(expectedtp)); for (TellrawPart extra : extras) expectedtp.addExtra(extra); - assertEquals(ChatProcessing.toJson(expectedtp), ChatProcessing.toJson(tp));*/ - assertTrue(true); + assertEquals(ChatProcessing.toJson(expectedtp), ChatProcessing.toJson(tp)); } }