More cleanup
This commit is contained in:
parent
c2141ce38b
commit
eba88b2773
17 changed files with 35 additions and 27 deletions
|
@ -58,7 +58,7 @@ artifacts {
|
||||||
test {
|
test {
|
||||||
testLogging {
|
testLogging {
|
||||||
events "failed", "skipped"
|
events "failed", "skipped"
|
||||||
showStandardStreams true
|
showStandardStreams = true
|
||||||
showExceptions true
|
showExceptions true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class CommandDispatcher<T> {
|
||||||
context.getCommand().run(context);
|
context.getCommand().run(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CommandContext<T> parseNodes(CommandNode node, String command, CommandContextBuilder<T> contextBuilder) throws CommandException {
|
private CommandContext<T> parseNodes(CommandNode node, String command, CommandContextBuilder<T> contextBuilder) throws CommandException {
|
||||||
CommandException exception = null;
|
CommandException exception = null;
|
||||||
|
|
||||||
for (CommandNode child : node.getChildren()) {
|
for (CommandNode child : node.getChildren()) {
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class IntegerArgumentType implements CommandArgumentType<Integer> {
|
||||||
private final int minimum;
|
private final int minimum;
|
||||||
private final int maximum;
|
private final int maximum;
|
||||||
|
|
||||||
protected IntegerArgumentType(int minimum, int maximum) {
|
private IntegerArgumentType(int minimum, int maximum) {
|
||||||
this.minimum = minimum;
|
this.minimum = minimum;
|
||||||
this.maximum = maximum;
|
this.maximum = maximum;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ public abstract class ArgumentBuilder<T extends ArgumentBuilder<?>> {
|
||||||
return getThis();
|
return getThis();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command getCommand() {
|
protected Command getCommand() {
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class LiteralArgumentBuilder extends ArgumentBuilder<LiteralArgumentBuild
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLiteral() {
|
private String getLiteral() {
|
||||||
return literal;
|
return literal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ public class RequiredArgumentBuilder<T> extends ArgumentBuilder<RequiredArgument
|
||||||
private final String name;
|
private final String name;
|
||||||
private final CommandArgumentType<T> type;
|
private final CommandArgumentType<T> type;
|
||||||
|
|
||||||
protected RequiredArgumentBuilder(String name, CommandArgumentType<T> type) {
|
private RequiredArgumentBuilder(String name, CommandArgumentType<T> type) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,11 @@ public class RequiredArgumentBuilder<T> extends ArgumentBuilder<RequiredArgument
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandArgumentType<T> getType() {
|
private CommandArgumentType<T> getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
private String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,11 @@ import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
public class CommandDispatcherTest {
|
public class CommandDispatcherTest {
|
||||||
CommandDispatcher<Object> subject;
|
private CommandDispatcher<Object> subject;
|
||||||
@Mock Command command;
|
@Mock
|
||||||
@Mock Object source;
|
private Command command;
|
||||||
|
@Mock
|
||||||
|
private Object source;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
|
|
@ -20,9 +20,11 @@ import static org.junit.Assert.fail;
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
public class CommandDispatcherUsagesTest {
|
public class CommandDispatcherUsagesTest {
|
||||||
CommandDispatcher<Object> subject;
|
private CommandDispatcher<Object> subject;
|
||||||
@Mock Object source;
|
@Mock
|
||||||
@Mock Command command;
|
private Object source;
|
||||||
|
@Mock
|
||||||
|
private Command command;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
|
|
@ -19,7 +19,7 @@ import static org.junit.Assert.assertThat;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
public class IntegerArgumentTypeTest {
|
public class IntegerArgumentTypeTest {
|
||||||
IntegerArgumentType type;
|
private IntegerArgumentType type;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import static org.hamcrest.Matchers.hasSize;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
public class ArgumentBuilderTest {
|
public class ArgumentBuilderTest {
|
||||||
TestableArgumentBuilder builder;
|
private TestableArgumentBuilder builder;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
|
|
@ -13,8 +13,9 @@ import static org.hamcrest.Matchers.is;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
public class LiteralArgumentBuilderTest {
|
public class LiteralArgumentBuilderTest {
|
||||||
LiteralArgumentBuilder builder;
|
private LiteralArgumentBuilder builder;
|
||||||
@Mock
|
@Mock
|
||||||
|
private
|
||||||
Command command;
|
Command command;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
|
|
@ -14,9 +14,11 @@ import static org.hamcrest.Matchers.is;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
public class RequiredArgumentBuilderTest {
|
public class RequiredArgumentBuilderTest {
|
||||||
@Mock CommandArgumentType<Integer> type;
|
|
||||||
RequiredArgumentBuilder<Integer> builder;
|
|
||||||
@Mock
|
@Mock
|
||||||
|
private CommandArgumentType<Integer> type;
|
||||||
|
private RequiredArgumentBuilder<Integer> builder;
|
||||||
|
@Mock
|
||||||
|
private
|
||||||
Command command;
|
Command command;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
|
|
@ -18,8 +18,9 @@ import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
public class CommandContextTest {
|
public class CommandContextTest {
|
||||||
CommandContextBuilder<Object> builder;
|
private CommandContextBuilder<Object> builder;
|
||||||
@Mock Object source;
|
@Mock
|
||||||
|
private Object source;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
|
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
|
||||||
public class ParameterizedCommandExceptionTypeTest {
|
public class ParameterizedCommandExceptionTypeTest {
|
||||||
ParameterizedCommandExceptionType type;
|
private ParameterizedCommandExceptionType type;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
|
|
@ -20,8 +20,8 @@ import static org.junit.Assert.fail;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
public class ArgumentCommandNodeTest extends AbstractCommandNodeTest {
|
public class ArgumentCommandNodeTest extends AbstractCommandNodeTest {
|
||||||
ArgumentCommandNode<Integer> node;
|
private ArgumentCommandNode<Integer> node;
|
||||||
CommandContextBuilder<Object> contextBuilder;
|
private CommandContextBuilder<Object> contextBuilder;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CommandNode getCommandNode() {
|
protected CommandNode getCommandNode() {
|
||||||
|
|
|
@ -18,8 +18,8 @@ import static org.junit.Assert.fail;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
public class LiteralCommandNodeTest extends AbstractCommandNodeTest {
|
public class LiteralCommandNodeTest extends AbstractCommandNodeTest {
|
||||||
LiteralCommandNode node;
|
private LiteralCommandNode node;
|
||||||
CommandContextBuilder<Object> contextBuilder;
|
private CommandContextBuilder<Object> contextBuilder;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CommandNode getCommandNode() {
|
protected CommandNode getCommandNode() {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import static org.hamcrest.Matchers.is;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
public class RootCommandNodeTest extends AbstractCommandNodeTest {
|
public class RootCommandNodeTest extends AbstractCommandNodeTest {
|
||||||
RootCommandNode node;
|
private RootCommandNode node;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CommandNode getCommandNode() {
|
protected CommandNode getCommandNode() {
|
||||||
|
|
Loading…
Reference in a new issue