Search in sources :

Example 1 with ISOBitMap

use of org.jpos.iso.ISOBitMap in project jPOS by jpos.

the class VISA1PackagerTest method testUnpackThrowsNullPointerException3.

@Test
public void testUnpackThrowsNullPointerException3() throws Throwable {
    int[] sequence = new int[0];
    VISA1Packager vISA1Packager = new VISA1Packager(sequence, 100, "testVISA1PackagerBadResultCode", "testVISA1PackagerOkPattern");
    try {
        vISA1Packager.unpack(new ISOBitMap(100), (byte[]) null);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
        assertSame("vISA1Packager.filter", vISA1Packager, vISA1Packager.filter);
    }
}
Also used : ISOBitMap(org.jpos.iso.ISOBitMap) Test(org.junit.Test)

Example 2 with ISOBitMap

use of org.jpos.iso.ISOBitMap in project jPOS by jpos.

the class VISA1PackagerTest method testUnpackThrowsISOException1.

@Test
public void testUnpackThrowsISOException1() throws Throwable {
    int[] sequence = new int[3];
    VISA1Packager vISA1Packager = new VISA1Packager(sequence, 100, "testVISA1PackagerBadResultCode", "testVISA1PackagerOkPattern");
    byte[] b = new byte[3];
    try {
        vISA1Packager.unpack(new ISOBitMap(100), b);
        fail("Expected ISOException to be thrown");
    } catch (ISOException ex) {
        assertEquals("ex.getMessage()", "Can't add to Leaf", ex.getMessage());
        assertNull("ex.getNested()", ex.getNested());
        assertSame("vISA1Packager.filter", vISA1Packager, vISA1Packager.filter);
    }
}
Also used : ISOException(org.jpos.iso.ISOException) ISOBitMap(org.jpos.iso.ISOBitMap) Test(org.junit.Test)

Example 3 with ISOBitMap

use of org.jpos.iso.ISOBitMap in project jPOS by jpos.

the class CardHolderTest method testConstructorFieldsTwoBitmapThrowsNullPointerException.

@Test
public void testConstructorFieldsTwoBitmapThrowsNullPointerException() throws Throwable {
    ISOMsg m = new ISOMsg("testCardHolderMti");
    m.set(new ISOBitMap(2));
    try {
        new CardHolder(m);
        fail("Expected InvalidCardException to be thrown");
    } catch (NullPointerException ex) {
        assertEquals("m.getDirection()", 0, m.getDirection());
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) ISOBitMap(org.jpos.iso.ISOBitMap) Test(org.junit.Test)

Example 4 with ISOBitMap

use of org.jpos.iso.ISOBitMap in project jPOS by jpos.

the class Base1_BITMAP126Test method testPack.

@Test
public void testPack() throws Throwable {
    BitSet v = new BitSet(100);
    Base1_BITMAP126 base1_BITMAP126 = new Base1_BITMAP126(100, "testBase1_BITMAP126Description");
    byte[] result = base1_BITMAP126.pack(new ISOBitMap(100, v));
    assertEquals("result.length", 0, result.length);
}
Also used : BitSet(java.util.BitSet) ISOBitMap(org.jpos.iso.ISOBitMap) Test(org.junit.Test)

Aggregations

ISOBitMap (org.jpos.iso.ISOBitMap)4 Test (org.junit.Test)4 BitSet (java.util.BitSet)1 ISOException (org.jpos.iso.ISOException)1 ISOMsg (org.jpos.iso.ISOMsg)1