Create test for HelpSyntaxHelperTest

This commit is contained in:
ljacqu
2015-11-21 11:16:31 +01:00
parent 58dc15123c
commit a3f24bcb9a
5 changed files with 164 additions and 25 deletions
@@ -9,7 +9,11 @@ import fr.xephi.authme.util.ListUtils;
/**
*/
public class HelpSyntaxHelper {
public final class HelpSyntaxHelper {
private HelpSyntaxHelper() {
// Helper class
}
/**
* Get the proper syntax for a command.
@@ -19,8 +23,8 @@ public class HelpSyntaxHelper {
* @param alternativeLabel The alternative label to use for this command syntax.
* @param highlight True to highlight the important parts of this command.
*
* @return The command with proper syntax. */
* @return The command with proper syntax.
*/
@SuppressWarnings("StringConcatenationInsideStringBufferAppend")
public static String getCommandSyntax(CommandDescription commandDescription, CommandParts commandReference, String alternativeLabel, boolean highlight) {
// Create a string builder to build the command
@@ -35,9 +39,9 @@ public class HelpSyntaxHelper {
String commandLabel = helpCommandReference.get(helpCommandReference.getCount() - 1);
// Check whether the alternative label should be used
if(alternativeLabel != null)
if(alternativeLabel.trim().length() > 0)
commandLabel = alternativeLabel;
if (alternativeLabel != null && alternativeLabel.trim().length() > 0) {
commandLabel = alternativeLabel;
}
// Show the important bit of the command, highlight this part if required
sb.append(ListUtils.implode(parentCommand, (highlight ? ChatColor.YELLOW + "" + ChatColor.BOLD : "") + commandLabel, " "));