 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
170 package com.realtime.crossfire.jxclient.commands;
174 import java.util.Arrays;
175 import java.util.Collection;
176 import org.jetbrains.annotations.NotNull;
177 import org.junit.Assert;
178 import org.junit.Test;
227 check(
";;;", commands);
245 check(
"cmd;cmd;cm;cmd;cmd2", commands,
new CommandExec(cmd,
""),
new CommandExec(cmd,
""),
new CommandExec(
null,
"cm"),
new CommandExec(cmd,
""),
new CommandExec(
null,
"cmd2"));
298 check(
"bind cmd;cmd bind", commands,
new CommandExec(bind,
"cmd;cmd bind"));
300 check(
"bind cmd;cmd bind;bind cmd", commands,
new CommandExec(bind,
"cmd;cmd bind;bind cmd"));
302 check(
"bind cmd ; cmd bind ; bind cmd", commands,
new CommandExec(bind,
"cmd ; cmd bind ; bind cmd"));
312 private static void check(@NotNull
final CharSequence command, @NotNull
final Commands commands, @NotNull
final CommandExec... commandList) {
314 Assert.assertEquals(Arrays.asList(commandList), expandedCommands);
static void check(@NotNull final CharSequence command, @NotNull final Commands commands, @NotNull final CommandExec... commandList)
Checks that CommandExpander#expand(CharSequence, Commands) works as expected.
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
static Collection< CommandExec > expand(@NotNull final CharSequence commandList, @NotNull final Commands commands)
Expands a command list into a sequence of Commands to execute.
A Command for regression tests.
void testExpandPredefined()
Checks that CommandExpander#expand(CharSequence, Commands) detects predefined commands.
void testExpandIgnoreWhitespace()
Checks that CommandExpander#expand(CharSequence, Commands) allows whitespace before or after the comm...
Parses and executes client-side commands.
Expands a command (or list of commands) into a sequence of Commands to execute.
void testExpandAllArguments()
Checks that CommandExpander#expand(CharSequence, Commands) correctly parses commands that consume all...
void testExpandIgnoreEmpty()
Checks that CommandExpander#expand(CharSequence, Commands) ignores empty commands.
void testExpandCaseInsensitiveCommandNames()
Checks that CommandExpander#expand(CharSequence, Commands) matches command names case-insensitive.
Regression test for CommandExpander.
void testExpandArguments()
Checks that CommandExpander#expand(CharSequence, Commands) correctly parses command arguments.
void addCommand(@NotNull final Command command)
Adds an executable Command.
void testExpandSingle()
Checks that CommandExpander#expand(CharSequence, Commands) works as expected.
Implements CrossfireServerConnection for regression tests.
A Command instance and its arguments.
void testExpandMultiple()
Checks that CommandExpander#expand(CharSequence, Commands) works as expected.