Search in sources :

Example 1 with IFE_CHAR

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

the class CTCSubElementPackagerTest method testUnpackThrowsISOException.

@Test
public void testUnpackThrowsISOException() throws Throwable {
    CTCSubElementPackager cTCSubElementPackager = new CTCSubElementPackager();
    ISOFieldPackager[] fld = new ISOFieldPackager[2];
    cTCSubElementPackager.setFieldPackager(fld);
    cTCSubElementPackager.setLogger(new Logger(), "testCTCSubElementPackagerRealm");
    cTCSubElementPackager.setFieldPackager(0, new IFE_CHAR());
    byte[] b = new byte[2];
    try {
        cTCSubElementPackager.unpack(new ISOVField(new ISOField(100, "testCTCSubElementPackagerv"), null), 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());
    }
}
Also used : ISOField(org.jpos.iso.ISOField) ISOException(org.jpos.iso.ISOException) ISOVField(org.jpos.iso.ISOVField) ISOFieldPackager(org.jpos.iso.ISOFieldPackager) Logger(org.jpos.util.Logger) IFE_CHAR(org.jpos.iso.IFE_CHAR) Test(org.junit.Test)

Example 2 with IFE_CHAR

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

the class CTCSubFieldPackagerTest method testUnpackThrowsNullPointerException.

@Test(expected = NullPointerException.class)
public void testUnpackThrowsNullPointerException() throws Throwable {
    ISOFieldPackager[] fld = new ISOFieldPackager[4];
    fld[0] = new IFE_CHAR();
    CTCSubFieldPackager cTCSubFieldPackager = new CTCSubFieldPackager();
    cTCSubFieldPackager.setFieldPackager(fld);
    byte[] b = new byte[2];
    cTCSubFieldPackager.unpack(null, b);
}
Also used : ISOFieldPackager(org.jpos.iso.ISOFieldPackager) IFE_CHAR(org.jpos.iso.IFE_CHAR) Test(org.junit.Test)

Aggregations

IFE_CHAR (org.jpos.iso.IFE_CHAR)2 ISOFieldPackager (org.jpos.iso.ISOFieldPackager)2 Test (org.junit.Test)2 ISOException (org.jpos.iso.ISOException)1 ISOField (org.jpos.iso.ISOField)1 ISOVField (org.jpos.iso.ISOVField)1 Logger (org.jpos.util.Logger)1