Merge ListUtil into StringUtil; refactor HelpSyntaxHelper + create test
The HelpSyntaxHelper had suppressed warnings for string concatenation within StringBuilder - the point of the StringBuilder is that it is faster when you use it to concatenate many elements. If you still use string concatenation with + within these calls it beats the purpose.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package fr.xephi.authme.command;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
/**
|
||||
* Test for {@link CommandParts}.
|
||||
*/
|
||||
public class CommandPartsTest {
|
||||
|
||||
@Test
|
||||
public void shouldPrintPartsForStringRepresentation() {
|
||||
// given
|
||||
CommandParts parts = new CommandParts(Arrays.asList("some", "parts", "for", "test"));
|
||||
|
||||
// when
|
||||
String str = parts.toString();
|
||||
|
||||
// then
|
||||
assertThat(str, equalTo("some parts for test"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldPrintEmptyStringForNoArguments() {
|
||||
// given
|
||||
CommandParts parts = new CommandParts();
|
||||
|
||||
// when
|
||||
String str = parts.toString();
|
||||
|
||||
// then
|
||||
assertThat(str, equalTo(""));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user