summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pom.xml16
-rw-r--r--src/main/java/org/uic/barcode/staticFrame/StaticFrame.java1
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv1/TrainLinkType.java4
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java4
-rw-r--r--src/main/java/org/uic/barcode/ticket/api/impl/SimpleTrainLink.java15
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/AsnLevelPassTimeZoneTestTicketV1.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/AsnLevelPassTimeZoneTestTicketV1.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV1.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV1.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV2.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV2.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/DelayTestTicketV3.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/DelayTestTicketV3.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV1.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV1.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV2.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV2.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/OpenTestTicketV1.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/OpenTestTicketV1.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV1.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV1.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV2.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV2.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV1.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV1.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV2.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV2.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/PassTestTicketV1.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/PassTestTicketV1.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase1V1.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase1V1.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase2V1.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase2V1.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase3V1.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase3V1.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketV2.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketV2.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV1.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV1.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV2.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV2.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/SimpleTicketLinkTestTicket.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/SimpleTicketLinkTestTicket.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/SimpleUicTestTicket.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/SimpleUicTestTicket.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV1.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV1.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV2.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV2.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV1.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV1.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV2.java (renamed from src/main/java/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV2.java)0
-rw-r--r--src/test/java/org/uic/barcode/ticketTestDB/DecodeSparpreisTicketDBTest.java61
30 files changed, 79 insertions, 22 deletions
diff --git a/pom.xml b/pom.xml
index e92db31..24157be 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.uic.barcode</groupId>
<artifactId>org.uic.barcode</artifactId>
- <version>1.2.2-SNAPSHOT</version>
+ <version>1.2.3-SNAPSHOT</version>
<packaging>jar</packaging>
<name>UIC barcode</name>
<description>encoding and decoding of bar code content according to UIC IRS 90918-9</description>
@@ -55,20 +55,6 @@
</build>
- <dependencies>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <version>5.5.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.bouncycastle</groupId>
- <artifactId>bcprov-jdk15to18</artifactId>
- <version>1.6.5</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
<licenses>
<license>
diff --git a/src/main/java/org/uic/barcode/staticFrame/StaticFrame.java b/src/main/java/org/uic/barcode/staticFrame/StaticFrame.java
index 5246ac7..639af69 100644
--- a/src/main/java/org/uic/barcode/staticFrame/StaticFrame.java
+++ b/src/main/java/org/uic/barcode/staticFrame/StaticFrame.java
@@ -488,7 +488,6 @@ public class StaticFrame {
throw (new EncodingFormatException(String.format("UIC Barcode Version %s not supported", versionValue)));
}
-
String lengthValue = new String( Arrays.copyOfRange(inputData,offset,offset + 4));
offset = offset + 4;
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TrainLinkType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TrainLinkType.java
index 5469c2f..6cc1c42 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TrainLinkType.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/TrainLinkType.java
@@ -44,11 +44,11 @@ public class TrainLinkType extends Object {
@FieldOrder(order = 2)
@IntRange(minValue=0,maxValue=370)
- @Asn1Optional public Long travelDate;
+ public Long travelDate;
@FieldOrder(order = 3)
@IntRange(minValue=0,maxValue=1440)
- @Asn1Optional public Long departureTime;
+ public Long departureTime;
@FieldOrder(order = 4)
@IntRange(minValue=-60, maxValue=60)
diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java
index f269497..16a101e 100644
--- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java
+++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java
@@ -44,11 +44,11 @@ public class TrainLinkType extends Object {
@FieldOrder(order = 2)
@IntRange(minValue=0,maxValue=370)
- @Asn1Optional public Long travelDate;
+ public Long travelDate;
@FieldOrder(order = 3)
@IntRange(minValue=0,maxValue=1440)
- @Asn1Optional public Long departureTime;
+ public Long departureTime;
@FieldOrder(order = 4)
@IntRange(minValue=-60, maxValue=60)
diff --git a/src/main/java/org/uic/barcode/ticket/api/impl/SimpleTrainLink.java b/src/main/java/org/uic/barcode/ticket/api/impl/SimpleTrainLink.java
index 73403cd..12a5305 100644
--- a/src/main/java/org/uic/barcode/ticket/api/impl/SimpleTrainLink.java
+++ b/src/main/java/org/uic/barcode/ticket/api/impl/SimpleTrainLink.java
@@ -88,7 +88,13 @@ public class SimpleTrainLink implements ITrainLink{
* @see org.uic.ticket.api.spec.ITrainLink#setToStation(java.lang.String)
*/
public void setToStation(String toStation) {
- this.toStation = toStation.trim();
+ if (toStation != null) {
+ this.toStation = toStation.trim();
+ } else {
+ this.toStation = null;
+ }
+
+
}
/* (nicht-Javadoc)
@@ -102,7 +108,12 @@ public class SimpleTrainLink implements ITrainLink{
* @see org.uic.ticket.api.spec.ITrainLink#setFromStationName(java.lang.String)
*/
public void setFromStationName(String fromStationName) {
- this.fromStationName = fromStationName.trim();
+ if (fromStationName != null) {
+ this.fromStationName = fromStationName.trim();
+ } else {
+ this.fromStationName = null;
+ }
+
}
/* (nicht-Javadoc)
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/AsnLevelPassTimeZoneTestTicketV1.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/AsnLevelPassTimeZoneTestTicketV1.java
index 5408638..5408638 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/AsnLevelPassTimeZoneTestTicketV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/AsnLevelPassTimeZoneTestTicketV1.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV1.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV1.java
index 09faac8..09faac8 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV1.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV2.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV2.java
index 7f01b94..7f01b94 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV2.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV2.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/DelayTestTicketV3.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/DelayTestTicketV3.java
index 9364acd..9364acd 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/DelayTestTicketV3.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/DelayTestTicketV3.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV1.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV1.java
index bfd54fe..bfd54fe 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV1.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV2.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV2.java
index 08b4507..08b4507 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV2.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/FipTimeZoneTestTicketV2.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/OpenTestTicketV1.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/OpenTestTicketV1.java
index 69a61a9..69a61a9 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/OpenTestTicketV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/OpenTestTicketV1.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV1.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV1.java
index 5ca6b73..5ca6b73 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV1.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV2.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV2.java
index 3acc754..3acc754 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV2.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/OpenTicketTimeZoneTestTicketV2.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV1.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV1.java
index ad70424..ad70424 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV1.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV2.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV2.java
index 99d9711..99d9711 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV2.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/ParkingTestTicketV2.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/PassTestTicketV1.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/PassTestTicketV1.java
index a165308..a165308 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/PassTestTicketV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/PassTestTicketV1.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase1V1.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase1V1.java
index 8bea50a..8bea50a 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase1V1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase1V1.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase2V1.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase2V1.java
index cc30e72..cc30e72 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase2V1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase2V1.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase3V1.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase3V1.java
index 715a292..715a292 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase3V1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketCase3V1.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketV2.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketV2.java
index 7539f0d..7539f0d 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketV2.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/PassTimeZoneTestTicketV2.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV1.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV1.java
index 840b584..840b584 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV1.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV2.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV2.java
index ef84644..ef84644 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV2.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/ReservationTestTicketV2.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/SimpleTicketLinkTestTicket.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/SimpleTicketLinkTestTicket.java
index d752043..d752043 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/SimpleTicketLinkTestTicket.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/SimpleTicketLinkTestTicket.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/SimpleUicTestTicket.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/SimpleUicTestTicket.java
index d8adb3d..d8adb3d 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/SimpleUicTestTicket.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/SimpleUicTestTicket.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV1.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV1.java
index b0626f1..b0626f1 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV1.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV2.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV2.java
index c551293..c551293 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV2.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/StationPassageTestTicketV2.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV1.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV1.java
index b3c2a76..b3c2a76 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV1.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV1.java
diff --git a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV2.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV2.java
index e7844d6..e7844d6 100644
--- a/src/main/java/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV2.java
+++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/VoucherTestTicketV2.java
diff --git a/src/test/java/org/uic/barcode/ticketTestDB/DecodeSparpreisTicketDBTest.java b/src/test/java/org/uic/barcode/ticketTestDB/DecodeSparpreisTicketDBTest.java
new file mode 100644
index 0000000..5af8bc2
--- /dev/null
+++ b/src/test/java/org/uic/barcode/ticketTestDB/DecodeSparpreisTicketDBTest.java
@@ -0,0 +1,61 @@
+package org.uic.barcode.ticketTestDB;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.uic.barcode.Decoder;
+import org.uic.barcode.asn1.uper.UperEncoder;
+import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout;
+import org.uic.barcode.ticket.api.spec.IOpenTicket;
+import org.uic.barcode.ticket.api.spec.ITrainLink;
+import org.uic.barcode.ticket.api.spec.IUicRailTicket;
+
+public class DecodeSparpreisTicketDBTest {
+
+ @Test
+ public void testDecoder() throws Exception {
+
+
+ byte[] content = UperEncoder.bytesFromHexString(getEncodingV2Hex());
+
+ // try to decode
+ Decoder decoder = new Decoder(content);
+ TicketLayout layout = decoder.getLayout();
+ IUicRailTicket ticket = decoder.getUicTicket();
+
+
+ Assert.assertNotNull(ticket);
+
+ Assert.assertNotNull(ticket.getDocumentData());
+ Assert.assertNotNull(ticket.getIssuerDetails());
+ Assert.assertNotNull(ticket.getTravelerDetails());
+ assert(ticket.getTravelerDetails().getTravelers().size() == 1);
+ assert(ticket.getDocumentData().size() == 1);
+ IOpenTicket openTicket = (IOpenTicket) ticket.getDocumentData().iterator().next();
+ Assert.assertNotNull(openTicket.getValidRegionList());
+ ITrainLink tl = (ITrainLink) openTicket.getValidRegionList().iterator().next();
+ assert(tl.getTrain().contentEquals("ICE973"));
+ Assert.assertNotNull(decoder);
+ }
+
+ public static String getEncodingV2Hex() {
+
+ return "2355543032313038303030303032782e" +
+ "2fe184a1d85e89e9338b298ec61aeba2" +
+ "48ce722056ca940a967c8a1d39126e2c" +
+ "628c4fcea91ba35216a0a350f894de5e" +
+ "bd7b8909920fde947feede0e20c43031" +
+ "3939789c01bc0043ff555f464c455831" +
+ "333031383862b20086e10dc125ea2815" +
+ "110881051c844464d985668e23a00a80" +
+ "000e96c2e4e6e8cadc08aed2d8d90104" +
+ "44d7be0100221ce610ea559b64364c38" +
+ "a82361d1cb5e1e5d32a3d0979bd099c8" +
+ "426b0b7373432b4b6852932baba3634b" +
+ "733b2b715ab34b09d101e18981c181f1" +
+ "424221521291521292a17a3a920a1152" +
+ "5a095282314952b20a49529952826278" +
+ "083001a4c38ae5bb303ace7003800700" +
+ "14b00240400f53757065722053706172" +
+ "7072656973c41e4a03";
+ }
+} \ No newline at end of file