diff options
author | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2021-11-25 16:28:36 +0100 |
---|---|---|
committer | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2021-11-25 16:28:36 +0100 |
commit | 7f96cbde68c325719d08282cc850e4a704b43100 (patch) | |
tree | ca00d8bae19bfcb5d7d55b388b568136ea62b57d /src/test/java/org/uic/barcode/ticket/api/test/CountermarkComplexTestV3.java | |
parent | more tests (diff) | |
download | UIC-barcode-7f96cbde68c325719d08282cc850e4a704b43100.tar UIC-barcode-7f96cbde68c325719d08282cc850e4a704b43100.tar.gz UIC-barcode-7f96cbde68c325719d08282cc850e4a704b43100.tar.bz2 UIC-barcode-7f96cbde68c325719d08282cc850e4a704b43100.tar.lz UIC-barcode-7f96cbde68c325719d08282cc850e4a704b43100.tar.xz UIC-barcode-7f96cbde68c325719d08282cc850e4a704b43100.tar.zst UIC-barcode-7f96cbde68c325719d08282cc850e4a704b43100.zip |
Diffstat (limited to 'src/test/java/org/uic/barcode/ticket/api/test/CountermarkComplexTestV3.java')
-rw-r--r-- | src/test/java/org/uic/barcode/ticket/api/test/CountermarkComplexTestV3.java | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/src/test/java/org/uic/barcode/ticket/api/test/CountermarkComplexTestV3.java b/src/test/java/org/uic/barcode/ticket/api/test/CountermarkComplexTestV3.java new file mode 100644 index 0000000..86495f0 --- /dev/null +++ b/src/test/java/org/uic/barcode/ticket/api/test/CountermarkComplexTestV3.java @@ -0,0 +1,111 @@ +package org.uic.barcode.ticket.api.test;
+
+import java.text.ParseException;
+import java.util.TimeZone;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.ticket.api.asn.omv3.UicRailTicketData;
+import org.uic.barcode.ticket.api.test.testtickets.CountermarkTestComplexTicketV3;
+
+
+/**
+ * The Class FipTimeZoneTestV3.
+ *
+ *
+ *
+ */
+public class CountermarkComplexTestV3 {
+
+
+
+ /** The ticket decoded 1. */
+ UicRailTicketData ticket = null;
+
+ byte[] encodedInTimeZone1 = null;
+
+
+ TimeZone defaulttimeZone = null;
+
+ /**
+ * Prepare tickets.
+ */
+ @Before public void prepare() {
+
+ defaulttimeZone = TimeZone.getDefault();
+
+ //encode in UTC time zone
+ TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+
+
+ }
+
+ /**
+ * clean up
+ */
+ @After public void resetTimeZone() {
+ TimeZone.setDefault(defaulttimeZone);
+ }
+
+
+ /**
+ * Test encode test tickets in UTC and decode in CET.
+ *
+ * @throws IllegalArgumentException the illegal argument exception
+ * @throws IllegalAccessException the illegal access exception
+ * @throws ParseException
+ */
+ @Test public void decoding() {
+
+ //get tickets
+ String hex = CountermarkTestComplexTicketV3.getEncodingHex();
+ byte[] content = UperEncoder.bytesFromHexString(hex);
+ ticket = UperEncoder.decode(content, UicRailTicketData.class);
+
+ assert(ticket != null);
+
+ }
+
+ @Test public void encoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ String hex = CountermarkTestComplexTicketV3.getEncodingHex();
+ byte[] content = UperEncoder.bytesFromHexString(hex);
+ ticket = UperEncoder.decode(content, UicRailTicketData.class);
+
+
+ //ticket = OpenTestComplexTicketV2.getUicTestTicket();
+ byte[] encoded = UperEncoder.encode(ticket);
+
+
+
+ assert(encoded != null);
+ assert(encoded.length > 20);
+
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = CountermarkTestComplexTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ }
+
+ @Test public void encodingDecoding() throws IllegalArgumentException, IllegalAccessException, ParseException {
+
+ //get tickets
+ ticket = CountermarkTestComplexTicketV3.getUicTestTicket();
+ byte[] encoded = UperEncoder.encode(ticket);
+
+
+
+ assert(encoded != null);
+ assert(encoded.length > 20);
+
+ String encodedHex = UperEncoder.hexStringFromBytes(encoded);
+ String expectedHex = CountermarkTestComplexTicketV3.getEncodingHex();
+
+ assert(expectedHex.equals(encodedHex));
+
+ }
+}
|