Search in sources :

Example 21 with ISOFieldPackager

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

the class CTCSubFieldPackagerTest method testPack1.

@Test
public void testPack1() throws Throwable {
    CTCSubFieldPackager cTCSubFieldPackager = new CTCSubFieldPackager();
    ISOFieldPackager[] fld = new ISOFieldPackager[1];
    cTCSubFieldPackager.setFieldPackager(fld);
    byte[] result = cTCSubFieldPackager.pack(new ISOField());
    assertEquals("result.length", 0, result.length);
}
Also used : ISOField(org.jpos.iso.ISOField) ISOFieldPackager(org.jpos.iso.ISOFieldPackager) Test(org.junit.Test)

Example 22 with ISOFieldPackager

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

the class EuroSubFieldPackagerTest method testPack3.

@Test
public void testPack3() throws Throwable {
    EuroSubFieldPackager euroSubFieldPackager = new EuroSubFieldPackager();
    ISOFieldPackager[] fld = new ISOFieldPackager[1];
    euroSubFieldPackager.setFieldPackager(fld);
    byte[] result = euroSubFieldPackager.pack(new ISOField());
    assertEquals("result.length", 0, result.length);
}
Also used : ISOField(org.jpos.iso.ISOField) ISOFieldPackager(org.jpos.iso.ISOFieldPackager) Test(org.junit.Test)

Example 23 with ISOFieldPackager

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

the class GenericPackagerTest method testGetBitMapfieldPackager.

@Test
public void testGetBitMapfieldPackager() throws Throwable {
    ISOFieldPackager iFA_AMOUNT = new IFA_AMOUNT();
    ISOFieldPackager[] fld = new ISOFieldPackager[2];
    fld[1] = iFA_AMOUNT;
    GenericPackager genericPackager = new GenericPackager();
    genericPackager.setFieldPackager(fld);
    ISOFieldPackager result = genericPackager.getBitMapfieldPackager();
    assertSame("result", iFA_AMOUNT, result);
}
Also used : IFA_AMOUNT(org.jpos.iso.IFA_AMOUNT) ISOFieldPackager(org.jpos.iso.ISOFieldPackager) Test(org.junit.Test)

Example 24 with ISOFieldPackager

use of org.jpos.iso.ISOFieldPackager 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)

Example 25 with ISOFieldPackager

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

the class GenericSubFieldPackagerTest method testUnpackThrowsISOException.

@Test
public void testUnpackThrowsISOException() throws Throwable {
    ISOFieldPackager[] fld = new ISOFieldPackager[0];
    GenericSubFieldPackager genericSubFieldPackager = new GenericSubFieldPackager();
    genericSubFieldPackager.setFieldPackager(fld);
    byte[] b = new byte[2];
    try {
        genericSubFieldPackager.unpack(new ISOMsg(), b);
        fail("Expected ISOException to be thrown");
    } catch (ISOException ex) {
    // assertEquals("ex.getMessage()", "java.lang.ArrayIndexOutOfBoundsException: 1", ex.getMessage());
    // assertEquals("ex.getNested().getMessage()", "1", ex.getNested().getMessage());
    }
}
Also used : ISOException(org.jpos.iso.ISOException) ISOMsg(org.jpos.iso.ISOMsg) ISOFieldPackager(org.jpos.iso.ISOFieldPackager) Test(org.junit.Test)

Aggregations

ISOFieldPackager (org.jpos.iso.ISOFieldPackager)28 Test (org.junit.Test)24 ISOException (org.jpos.iso.ISOException)12 ISOMsg (org.jpos.iso.ISOMsg)12 ISOField (org.jpos.iso.ISOField)5 Logger (org.jpos.util.Logger)4 IOException (java.io.IOException)3 IFA_LCHAR (org.jpos.iso.IFA_LCHAR)3 ISOBinaryField (org.jpos.iso.ISOBinaryField)3 ISOComponent (org.jpos.iso.ISOComponent)3 ISOTaggedField (org.jpos.tlv.ISOTaggedField)3 LogEvent (org.jpos.util.LogEvent)3 IFA_AMOUNT (org.jpos.iso.IFA_AMOUNT)2 IFA_LLLLCHAR (org.jpos.iso.IFA_LLLLCHAR)2 IFE_CHAR (org.jpos.iso.IFE_CHAR)2 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 ConfigurationException (org.jpos.core.ConfigurationException)1