#305 Modularize logic / separate from data classes (wip – doesn't compile)

- Remove permission logic on command side; make PermissionsManager handle checks for all CommandSender objects (not only Player), cf. #314
- Remove unnecessary redundancies in passed arguments ("command references" that can be inferred from the FoundResult)
- Extend FoundCommandResult to represent all possible error cases
This commit is contained in:
ljacqu
2015-12-12 00:43:55 +01:00
parent ec9009d776
commit 2f153fb85c
8 changed files with 178 additions and 245 deletions
@@ -4,22 +4,23 @@ import org.junit.Test;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
/**
* Test for {@link CommandParts}.
* Test for {@link CommandUtils}.
*/
public class CommandPartsTest {
public class CommandUtilsTest {
@Test
public void shouldPrintPartsForStringRepresentation() {
// given
CommandParts parts = new CommandParts(Arrays.asList("some", "parts", "for", "test"));
Iterable<String> parts = Arrays.asList("some", "parts", "for", "test");
// when
String str = parts.toString();
String str = CommandUtils.labelsToString(parts);
// then
assertThat(str, equalTo("some parts for test"));
@@ -28,10 +29,10 @@ public class CommandPartsTest {
@Test
public void shouldPrintEmptyStringForNoArguments() {
// given
CommandParts parts = new CommandParts(Collections.EMPTY_LIST);
List<String> parts = Collections.EMPTY_LIST;
// when
String str = parts.toString();
String str = CommandUtils.labelsToString(parts);
// then
assertThat(str, equalTo(""));