diff options
author | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2024-05-21 16:59:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-21 16:59:21 +0200 |
commit | ea8b8fc5cbbf728197b14a3f0353a8878ec83db3 (patch) | |
tree | 7b72ac9c435dc197c1a2a33f2a47447945cfaa50 /src/test/java/org/uic/barcode | |
parent | Merge pull request #80 from UnionInternationalCheminsdeFer/fixing_dsa_validation_without_algorithm (diff) | |
parent | fix test for dynamic content in years with feb29. (diff) | |
download | UIC-barcode-ea8b8fc5cbbf728197b14a3f0353a8878ec83db3.tar UIC-barcode-ea8b8fc5cbbf728197b14a3f0353a8878ec83db3.tar.gz UIC-barcode-ea8b8fc5cbbf728197b14a3f0353a8878ec83db3.tar.bz2 UIC-barcode-ea8b8fc5cbbf728197b14a3f0353a8878ec83db3.tar.lz UIC-barcode-ea8b8fc5cbbf728197b14a3f0353a8878ec83db3.tar.xz UIC-barcode-ea8b8fc5cbbf728197b14a3f0353a8878ec83db3.tar.zst UIC-barcode-ea8b8fc5cbbf728197b14a3f0353a8878ec83db3.zip |
Diffstat (limited to 'src/test/java/org/uic/barcode')
-rw-r--r-- | src/test/java/org/uic/barcode/test/DynamicContentCoderTest.java | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/test/java/org/uic/barcode/test/DynamicContentCoderTest.java b/src/test/java/org/uic/barcode/test/DynamicContentCoderTest.java index 4982536..07147bf 100644 --- a/src/test/java/org/uic/barcode/test/DynamicContentCoderTest.java +++ b/src/test/java/org/uic/barcode/test/DynamicContentCoderTest.java @@ -2,6 +2,8 @@ package org.uic.barcode.test; import java.text.ParseException;
import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.TimeZone;
import org.junit.Before;
import org.junit.Test;
@@ -48,9 +50,10 @@ public class DynamicContentCoderTest { g.setLongitude( 12345L);
g.setLatitude( 56789L);
content.setGeoCoordinate(g);
-
+
try {
- content.setTimeStamp(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
+ //needs to be before 28.2. to keep the test stable in year with febuary 29.
+ content.setTimeStamp(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.02.04-12:30" ));
} catch (ParseException e2) {
//
}
@@ -69,25 +72,18 @@ public class DynamicContentCoderTest { String encoding = UperEncoder.hexStringFromBytes(encodedBytes);
- String expectedEncoding = "7C170F0E12620F9437000230390300DDD504017A20C6D0C2D8D8CADCCECA40E6E8E4D2DCCE2F8F461D9B32EECF96FE5F1D32EEE7A77EEBFA72310282DA05E1A37EECA0507B409C30F3E60509B42F8F461D9B32EECF96FE5F1D32EEE7A77EEBFA72310282DA";
-
+ String expectedEncoding = "7C170F0E1262089437000230390300DDD504017A20C6D0C2D8D8CADCCECA40E6E8E4D2DCCE2F8F461D9B32EECF96FE5F1D32EEE7A77EEBFA72310282DA05E1A37EECA0507B409C30F3E60509B42F8F461D9B32EECF96FE5F1D32EEE7A77EEBFA72310282DA";
+
assert(expectedEncoding.equals(encoding));
}
@Test public void testDynamicContentDecoding() {
- String encoding = "7C170F0E12620F9437000230390300DDD504017A20C6D0C2D8D8CADCCECA40E6E8E4D2DCCE2F8F461D9B32EECF96FE5F1D32EEE7A77EEBFA72310282DA05E1A37EECA0507B409C30F3E60509B42F8F461D9B32EECF96FE5F1D32EEE7A77EEBFA72310282DA";
-
+
+ String encoding = "7C170F0E1262089437000230390300DDD504017A20C6D0C2D8D8CADCCECA40E6E8E4D2DCCE2F8F461D9B32EECF96FE5F1D32EEE7A77EEBFA72310282DA05E1A37EECA0507B409C30F3E60509B42F8F461D9B32EECF96FE5F1D32EEE7A77EEBFA72310282DA";
IUicDynamicContent content = DynamicContentCoder.decode(UperEncoder.bytesFromHexString(encoding));
-
- try {
- content.setTimeStamp(new SimpleDateFormat( "yyyy.MM.dd-HH:mm" ).parse( "2021.03.04-12:30" ));
- } catch (ParseException e2) {
- //
- }
-
-
+
assert("appID".equals(content.getAppId()));
|