Beispiel #1
0
  @Ignore("test currently failing - debug action required TODO: CCB")
  @Test
  public void test08ByteBitmap() throws Exception {

    ISOComponent c = new ISOBitMap(1);
    int consumed = eightBytes.unpack(c, inBytes, 0);
    assertEquals(
        "8 bytes should be consumed irrespective of 2nd and 3rd bitmap indicators", 8, consumed);
    assertEquals(
        "8 byte can only result in a bitmap holding fields up to 64",
        64,
        ((BitSet) c.getValue()).length() - 1);

    outBytes = eightBytes.pack(c);
    assertEquals(
        "8 byte bitmap pack should reflect unpack",
        ISOUtil.hexString(inBytes, 0, 8),
        ISOUtil.hexString(outBytes));

    try {
      outBytes = oneByte.pack(c);
      fail("Pack of bitmap with fields outside of 1 byte range should result in ISOException");
    } catch (Exception e) {
      // expected.
      assertEquals(
          "Bitmap can only hold fields numbered up to 8 in the 1 bytes available.", e.getMessage());
    }
  }
Beispiel #2
0
  @Ignore("test currently failing - debug action required TODO: CCB")
  @Test
  public void test24ByteBitmap() throws Exception {
    ISOComponent c = new ISOBitMap(1);
    int consumed = twentyfourBytes.unpack(c, inBytes, 0);
    assertEquals("All 24 Bytes should be consumed", 24, consumed);
    assertEquals(
        "24 byte can only result in a bitmap holding fields up to 192",
        192,
        ((BitSet) c.getValue()).length() - 1);

    outBytes = twentyfourBytes.pack(c);
    assertEquals(
        "24 byte bitmap pack should reflect unpack",
        ISOUtil.hexString(inBytes, 0, 24),
        ISOUtil.hexString(outBytes));

    try {
      outBytes = sixteenBytes.pack(c);
      fail("Pack of bitmap with fields outside of 16 byte range should result in ISOException");
    } catch (Exception e) {
      // expected.
      assertEquals(
          "Bitmap can only hold fields numbered up to 128 in the 16 bytes available.",
          e.getMessage());
    }

    try {
      outBytes = eightBytes.pack(c);
      fail("Pack of bitmap with fields outside of 8 byte range should result in ISOException");
    } catch (Exception e) {
      // expected.
      assertEquals(
          "Bitmap can only hold fields numbered up to 64 in the 8 bytes available.",
          e.getMessage());
    }

    try {
      outBytes = oneByte.pack(c);
      fail("Pack of bitmap with fields outside of 1 byte range should result in ISOException");
    } catch (Exception e) {
      // expected.
      assertEquals(
          "Bitmap can only hold fields numbered up to 8 in the 1 bytes available.", e.getMessage());
    }
  }
Beispiel #3
0
  @Test
  public void test24ByteBitmapWithOnly8BytesUsed() throws Exception {

    ISOComponent c = new ISOBitMap(1);
    int consumed = twentyfourBytes.unpack(c, eightByteBitMapIn24Bytes, 0);
    assertEquals("8 bytes should be consumed as the 2nd bitmap indicator if off", 8, consumed);
    assertEquals(
        "24 byte bitmap with just 8 bytes used should have a maximum field of ",
        64,
        ((BitSet) c.getValue()).length() - 1);

    outBytes = twentyfourBytes.pack(c);
    assertEquals(
        "24 Byte (8 bytes used) bitmap pack should reflect unpack",
        ISOUtil.hexString(eightByteBitMapIn24Bytes, 0, 8),
        ISOUtil.hexString(outBytes));
  }
Beispiel #4
0
  @Test
  public void test01ByteBitmap() throws Exception {

    ISOComponent c = new ISOBitMap(1);
    int consumed = oneByte.unpack(c, inBytes, 0);
    assertEquals(
        "1 byte should be consumed irrespective of 2nd, 3rd or any bitmap indicators", 1, consumed);
    assertEquals(
        "1 byte can only result in a bitmap holding fields up to 8",
        8,
        ((BitSet) c.getValue()).length() - 1);

    outBytes = oneByte.pack(c);
    assertEquals(
        "1 byte bitmap pack should reflect unpack",
        ISOUtil.hexString(inBytes, 0, 1),
        ISOUtil.hexString(outBytes));
  }