aboutsummaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/reader/test/CommandTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/cz/crcs/ectester/reader/test/CommandTest.java')
-rw-r--r--src/cz/crcs/ectester/reader/test/CommandTest.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cz/crcs/ectester/reader/test/CommandTest.java b/src/cz/crcs/ectester/reader/test/CommandTest.java
index d57dc17..adad191 100644
--- a/src/cz/crcs/ectester/reader/test/CommandTest.java
+++ b/src/cz/crcs/ectester/reader/test/CommandTest.java
@@ -6,6 +6,8 @@ import cz.crcs.ectester.common.test.TestCallback;
import cz.crcs.ectester.reader.command.Command;
import cz.crcs.ectester.reader.response.Response;
+import java.util.Arrays;
+
/**
* A simple test that runs one Command to get and evaluate one Response
* to get a Result and compare it with the expected one.
@@ -47,6 +49,23 @@ public class CommandTest extends SimpleTest<CommandTestable> {
return expect(command, expectedValue, null, null);
}
+ public static CommandTest expectSW(CommandTestable command, short... expectedSWS) {
+ return new CommandTest(command, new TestCallback<CommandTestable>() {
+ @Override
+ public Result apply(CommandTestable commandTestable) {
+ if (Arrays.equals(commandTestable.getResponse().getSWs(), expectedSWS)) {
+ return new Result(Result.Value.SUCCESS);
+ } else {
+ return new Result(Result.Value.FAILURE);
+ }
+ }
+ });
+ }
+
+ public static CommandTest expectSW(Command command, short... expectedSWS) {
+ return expectSW(new CommandTestable(command), expectedSWS);
+ }
+
public Command getCommand() {
return testable.getCommand();
}