Made every CommandNode support an executor

This commit is contained in:
Nathan Adams
2014-09-24 12:04:33 +02:00
parent 3ef22ef317
commit d13587a4df
6 changed files with 34 additions and 8 deletions
@@ -15,6 +15,7 @@ import static org.junit.Assert.assertThat;
public class RequiredArgumentBuilderTest {
@Mock CommandArgumentType<Integer> type;
RequiredArgumentBuilder<Integer> builder;
@Mock Runnable executor;
@Before
public void setUp() throws Exception {
@@ -29,6 +30,15 @@ public class RequiredArgumentBuilderTest {
assertThat(node.getType(), is(type));
}
@Test
public void testBuildWithExecutor() throws Exception {
ArgumentCommandNode<Integer> node = builder.executes(executor).build();
assertThat(node.getName(), is("foo"));
assertThat(node.getType(), is(type));
assertThat(node.getExecutor(), is(executor));
}
@Test
public void testBuildWithChildren() throws Exception {
builder.then(argument("bar", integer()));