LoginSystem/src/test/java/fr/xephi/authme/command/CommandPartsTest.java
ljacqu 4702a1b82d 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.
(cherry picked from commit bb00be2)
2015-11-21 12:12:26 +01:00

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(""));
}
}