-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request jpos#570 from Elias-Terranti/Bug/BerTlvAsciiPackager
issue jpos#568: fixed BERTLVAsciiHexPackager getUninterpretLength always returns 0 with AsciiHex interpreter
- Loading branch information
Showing
2 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
jpos/src/test/java/org/jpos/tlv/packager/bertlv/Bug568BERTLVAsciiHexPackager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.jpos.tlv.packager.bertlv; | ||
import org.bouncycastle.util.Arrays; | ||
import org.jpos.iso.*; | ||
import org.jpos.tlv.ISOTaggedField; | ||
|
||
import org.junit.jupiter.api.*; | ||
|
||
public class Bug568BERTLVAsciiHexPackager { | ||
|
||
final String HEX_ASCII = "9f2610e18d2a69a45dd09a9f360401839f3708ab34b0bd"; | ||
|
||
@Test | ||
public void testLenInterpretation() throws ISOException { | ||
final ISOMsg ICC_DATA = new ISOMsg(55); | ||
final BERTLVAsciiHexPackager packager = new BERTLVAsciiHexPackager(); | ||
final IFA_LLABINARY fieldPackager = new IFA_LLABINARY(); | ||
|
||
|
||
packager.setFieldPackager(new org.jpos.iso.ISOFieldPackager[]{fieldPackager}); | ||
ICC_DATA.setPackager(packager); | ||
|
||
ICC_DATA.unpack(HEX_ASCII.getBytes()); | ||
|
||
ICC_DATA.getChildren().values().forEach | ||
(e -> { | ||
try { | ||
ISOTaggedField field = (ISOTaggedField) e; | ||
final byte[] value = (byte[]) field.getValue(); | ||
System.out.println("tag " + field.getTag() + " value " + ISOUtil.hexString(value)); | ||
Assertions. | ||
assertFalse(Arrays.isNullOrEmpty(value)); | ||
|
||
} catch (ISOException ex) { | ||
throw new RuntimeException(ex); | ||
} | ||
}); | ||
|
||
|
||
} | ||
|
||
} | ||
|