Add equality checking to each command node
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package net.minecraft.commands.tree;
|
||||
|
||||
import com.google.common.testing.EqualsTester;
|
||||
import net.minecraft.commands.context.CommandContextBuilder;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static net.minecraft.commands.builder.LiteralArgumentBuilder.literal;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
@@ -18,6 +20,23 @@ public class RootCommandNodeTest {
|
||||
@Test
|
||||
public void testParse() throws Exception {
|
||||
assertThat(node.parse("foo bar baz", new CommandContextBuilder()), is("foo bar baz"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEquals() throws Exception {
|
||||
new EqualsTester()
|
||||
.addEqualityGroup(
|
||||
new RootCommandNode(),
|
||||
new RootCommandNode()
|
||||
)
|
||||
.addEqualityGroup(
|
||||
new RootCommandNode() {{
|
||||
addChild(literal("foo").build());
|
||||
}},
|
||||
new RootCommandNode() {{
|
||||
addChild(literal("foo").build());
|
||||
}}
|
||||
)
|
||||
.testEquals();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user