Skip to content

Commit

Permalink
Test of unpacking unsorted tags
Browse files Browse the repository at this point in the history
It profides test to unpacking functionality introduced in 686be85
  • Loading branch information
demsey committed Oct 4, 2019
1 parent 32163f1 commit 31417a6
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,20 @@ public class TaggedFieldPackagerBaseTest {

private static final String MESSAGE_VALUE1 = "06123456022A10748TagA1A30748TagA3012A100760TagA1";

/**
* Unsorted DE48 tags.
* <p>
* The A3 <i>(id 3)</i> before A1 <i>(id 1)</i>.
*/
private static final String MESSAGE_VALUE2 = "06123456022A30748TagA3A10748TagA1012A100760TagA1";

private static final String REPR_MESSAGE1 = MESSAGE_MTI1 + toString(MESSAGE_BITMAP1) + MESSAGE_VALUE1;

/**
* Unsorted DE48 tags message representation.
*/
private static final String REPR_MESSAGE2 = MESSAGE_MTI1 + toString(MESSAGE_BITMAP1) + MESSAGE_VALUE2;

private static ISOPackager packager;

@BeforeAll
Expand Down Expand Up @@ -107,6 +119,20 @@ public void testUnpack() throws Exception {
);
}

@Test
public void testUnpackUnsortedTags() throws Exception {
ISOMsg msg = new ISOMsg();
packager.unpack(msg, toBytes(REPR_MESSAGE2));

assertAll(
() -> assertEquals("1100", msg.getString(0)),
() -> assertEquals("123456", msg.getString(2)),
() -> assertEquals("48TagA1", msg.getString("48.1")),
() -> assertEquals("48TagA3", msg.getString("48.3")),
() -> assertEquals("60TagA1", msg.getString("60.1"))
);
}

public static class TagMapperImpl implements TagMapper {

private static final Map<String, Integer> MAP_TAG_MUMBER = new HashMap<>();
Expand Down

0 comments on commit 31417a6

Please sign in to comment.