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. (cherry picked from commit bb00be2)
39 lines
818 B
Java
39 lines
818 B
Java
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(""));
|
|
}
|
|
}
|