CommonCore/testsrc/de/steamwar/command/SimpleCommandTest.java
2022-04-22 10:16:25 +02:00

33 Zeilen
1001 B
Java

package de.steamwar.command;
import de.steamwar.command.dto.ExecutionIdentifier;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
public class SimpleCommandTest {
@Test
public void testSimpleParsing() {
SimpleCommand cmd = new SimpleCommand();
try {
cmd.execute("test", "", new String[0]);
} catch (CommandFrameworkException e) {
assertThat(e.getCause().getCause(), is(instanceOf(ExecutionIdentifier.class)));
assertThat(e.getCause().getCause().getMessage(), is("RunSimple with noArgs"));
}
}
@Test
public void testSimpleParsingNoResult() {
SimpleCommand cmd = new SimpleCommand();
try {
cmd.execute("test", "", new String[]{"Hello"});
} catch (CommandFrameworkException e) {
throw new AssertionError("No exception expected");
}
}
}