Search in sources :

Example 1 with IFA_LLLLCHAR

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

the class CTCSubFieldPackagerTest method testUnpackThrowsISOException.

@Test
public void testUnpackThrowsISOException() throws Throwable {
    CTCSubFieldPackager cTCSubFieldPackager = new CTCSubFieldPackager();
    ISOFieldPackager[] fld = new ISOFieldPackager[6];
    fld[0] = new IFA_LLLLCHAR(100, "testCTCSubFieldPackagerDescription");
    cTCSubFieldPackager.setFieldPackager(fld);
    byte[] b = new byte[4];
    try {
        cTCSubFieldPackager.unpack(new ISOField(), b);
        fail("Expected ISOException to be thrown");
    } catch (ISOException ex) {
        assertEquals("ex.getMessage()", "org.jpos.iso.IFA_LLLLCHAR: Problem unpacking field 0", ex.getMessage());
        assertNull("ex.getNested().getMessage()", ex.getNested().getMessage());
    }
}
Also used : ISOField(org.jpos.iso.ISOField) ISOException(org.jpos.iso.ISOException) ISOFieldPackager(org.jpos.iso.ISOFieldPackager) IFA_LLLLCHAR(org.jpos.iso.IFA_LLLLCHAR) Test(org.junit.Test)

Example 2 with IFA_LLLLCHAR

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

the class GenericSubFieldPackagerTest method testUnpackThrowsISOException8.

@Test
public void testUnpackThrowsISOException8() throws Throwable {
    ISOFieldPackager[] fld = new ISOFieldPackager[2];
    fld[1] = new IFA_LLLLCHAR();
    GenericSubFieldPackager genericSubFieldPackager = new GenericSubFieldPackager();
    genericSubFieldPackager.setFieldPackager(fld);
    genericSubFieldPackager.setLogger(new Logger(), "testGenericSubFieldPackagerRealm");
    byte[] b = new byte[5];
    try {
        genericSubFieldPackager.unpack(new ISOMsg(), b);
        fail("Expected ISOException to be thrown");
    } catch (ISOException ex) {
        assertEquals("ex.getMessage()", "org.jpos.iso.IFA_LLLLCHAR: Problem unpacking field -1", ex.getMessage());
        assertNull("ex.getNested().getMessage()", ex.getNested().getMessage());
    }
}
Also used : ISOException(org.jpos.iso.ISOException) ISOMsg(org.jpos.iso.ISOMsg) ISOFieldPackager(org.jpos.iso.ISOFieldPackager) IFA_LLLLCHAR(org.jpos.iso.IFA_LLLLCHAR) Logger(org.jpos.util.Logger) Test(org.junit.Test)

Aggregations

IFA_LLLLCHAR (org.jpos.iso.IFA_LLLLCHAR)2 ISOException (org.jpos.iso.ISOException)2 ISOFieldPackager (org.jpos.iso.ISOFieldPackager)2 Test (org.junit.Test)2 ISOField (org.jpos.iso.ISOField)1 ISOMsg (org.jpos.iso.ISOMsg)1 Logger (org.jpos.util.Logger)1