blob: 3cf143e007aa21b28e4dd03161a4ff92afc27bb7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
package org.uic.barcode.test;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import org.junit.Test;
import org.uic.barcode.staticFrame.UTLAYDataRecord;
import org.uic.barcode.staticFrame.ticketLayoutBarcode.TicketLayout;
import org.uic.barcode.test.utils.SimpleTestTicketLayout;
import org.uic.barcode.test.utils.TestUtils;
import org.uic.ticket.EncodingFormatException;
public class TicketLayoutTest {
@Test public void testTicketLayout() throws IOException, EncodingFormatException{
UTLAYDataRecord tl1 = new UTLAYDataRecord();
TicketLayout layout = SimpleTestTicketLayout.getSimpleTestTicketLayout();
tl1.setLayout(layout);
byte[] encoded = null;
try {
encoded = tl1.encode();
} catch (IOException e) {
throw (e);
}
String hex = TestUtils.hexStringFromBytes(encoded);
assertEquals(hex,"555F544C41593031303034305243543230303031303130313031323030303030374DC3BC6C6C6572");
UTLAYDataRecord tl2 = new UTLAYDataRecord();
tl2.decode(tl1.encode());
assertEquals(tl1.toString(),tl2.toString());
}
}
|