Search in sources :

Example 1 with IFB_LLLCHAR

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

the class EuroSubFieldPackagerTest method testUnpackThrowsNullPointerException1.

@Test
public void testUnpackThrowsNullPointerException1() throws Throwable {
    EuroSubFieldPackager euroSubFieldPackager = new EuroSubFieldPackager();
    ISOFieldPackager[] fld = new ISOFieldPackager[4];
    fld[0] = new IFB_LLLCHAR();
    euroSubFieldPackager.setFieldPackager(fld);
    byte[] b = new byte[3];
    try {
        euroSubFieldPackager.unpack(null, b);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        if (isJavaVersionAtMost(JAVA_14)) {
            assertNull(ex.getMessage(), "ex.getMessage()");
        } else {
            assertEquals("Cannot invoke \"org.jpos.iso.ISOComponent.set(org.jpos.iso.ISOComponent)\" because \"m\" is null", ex.getMessage(), "ex.getMessage()");
        }
    }
}
Also used : IFB_LLLCHAR(org.jpos.iso.IFB_LLLCHAR) ISOFieldPackager(org.jpos.iso.ISOFieldPackager) Test(org.junit.jupiter.api.Test)

Example 2 with IFB_LLLCHAR

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

the class ISOMsgFieldValidatingPackagerTest method testConstructor.

@Test
public void testConstructor() throws Throwable {
    ISOPackager msgPackager = new ISOBaseValidatingPackager();
    ISOMsgFieldValidatingPackager iSOMsgFieldValidatingPackager = new ISOMsgFieldValidatingPackager(new IFB_LLLCHAR(), msgPackager);
    assertNull(iSOMsgFieldValidatingPackager.getDescription(), "iSOMsgFieldValidatingPackager.getDescription()");
    assertEquals(-1, iSOMsgFieldValidatingPackager.getMaxPackedLength(), "iSOMsgFieldValidatingPackager.getMaxPackedLength()");
    assertEquals(-1, iSOMsgFieldValidatingPackager.getLength(), "iSOMsgFieldValidatingPackager.getLength()");
}
Also used : IFB_LLLCHAR(org.jpos.iso.IFB_LLLCHAR) ISOPackager(org.jpos.iso.ISOPackager) Test(org.junit.jupiter.api.Test)

Aggregations

IFB_LLLCHAR (org.jpos.iso.IFB_LLLCHAR)2 Test (org.junit.jupiter.api.Test)2 ISOFieldPackager (org.jpos.iso.ISOFieldPackager)1 ISOPackager (org.jpos.iso.ISOPackager)1