summaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/reader/test/CommandTestable.java
diff options
context:
space:
mode:
authorJ08nY2018-01-23 17:31:15 +0100
committerJ08nY2018-01-23 17:31:15 +0100
commitcb6c6b8b1274fe5a340c4317a4b015ea0ef15396 (patch)
tree864a54dcdf07da33cd139312c8b0ee693e1a0eff /src/cz/crcs/ectester/reader/test/CommandTestable.java
parent6c46a27a52854aee24f7a37e74002bd6f4485723 (diff)
parentc581e39e539e6dadb49d9f83f563ab2b375f6e0b (diff)
downloadECTester-0.2.0.tar.gz
ECTester-0.2.0.tar.zst
ECTester-0.2.0.zip
Diffstat (limited to 'src/cz/crcs/ectester/reader/test/CommandTestable.java')
-rw-r--r--src/cz/crcs/ectester/reader/test/CommandTestable.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/cz/crcs/ectester/reader/test/CommandTestable.java b/src/cz/crcs/ectester/reader/test/CommandTestable.java
new file mode 100644
index 0000000..3bb55bf
--- /dev/null
+++ b/src/cz/crcs/ectester/reader/test/CommandTestable.java
@@ -0,0 +1,44 @@
+package cz.crcs.ectester.reader.test;
+
+import cz.crcs.ectester.common.test.BaseTestable;
+import cz.crcs.ectester.common.test.TestException;
+import cz.crcs.ectester.reader.command.Command;
+import cz.crcs.ectester.reader.response.Response;
+
+import javax.smartcardio.CardException;
+
+/**
+ * @author Jan Jancar johny@neuromancer.sk
+ */
+public class CommandTestable extends BaseTestable {
+ private Command command;
+ private Response response;
+
+ public CommandTestable(Command command) {
+ this.command = command;
+ }
+
+ public Command getCommand() {
+ return command;
+ }
+
+ public Response getResponse() {
+ return response;
+ }
+
+ @Override
+ public void run() throws TestException {
+ try {
+ response = command.send();
+ } catch (CardException e) {
+ throw new TestException(e);
+ }
+
+ hasRun = true;
+ if (response.error()) {
+ error = true;
+ } else if (response.successful()) {
+ ok = true;
+ }
+ }
+}