Search in sources :

Example 1 with ISOVField

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

the class VErrorParserTest method testGetVErrors7.

@SuppressWarnings("unchecked")
@Test
public void testGetVErrors7() throws Throwable {
    VErrorParser vErrorParser = new VErrorParser();
    Vector result = vErrorParser.getVErrors(new ISOVField(new ISOField(100)));
    assertEquals("result.size()", 0, result.size());
}
Also used : ISOField(org.jpos.iso.ISOField) ISOVField(org.jpos.iso.ISOVField) Vector(java.util.Vector) Test(org.junit.Test)

Example 2 with ISOVField

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

the class VErrorParserTest method testGetVErrors1.

@SuppressWarnings("unchecked")
@Test
public void testGetVErrors1() throws Throwable {
    VErrorParser vErrorParser = new VErrorParser();
    ISOVError FirstError = new ISOVError("testVErrorParserDescription");
    ISOComponent c = new ISOVField(new ISOField(), FirstError);
    Vector result = vErrorParser.getVErrors(c);
    assertEquals("result.size()", 1, result.size());
    assertSame("result.get(0)", FirstError, result.get(0));
}
Also used : ISOField(org.jpos.iso.ISOField) ISOComponent(org.jpos.iso.ISOComponent) ISOVError(org.jpos.iso.ISOVError) ISOVField(org.jpos.iso.ISOVField) Vector(java.util.Vector) Test(org.junit.Test)

Example 3 with ISOVField

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

the class VErrorParserTest method testGetVErrorsThrowsNullPointerException3.

@Test
public void testGetVErrorsThrowsNullPointerException3() throws Throwable {
    VErrorParser vErrorParser = new VErrorParser();
    ISOVField c = new ISOVField(new ISOField(100, "testVErrorParserv"));
    c.addISOVError(null);
    try {
        vErrorParser.getVErrors(c);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ISOField(org.jpos.iso.ISOField) ISOVField(org.jpos.iso.ISOVField) Test(org.junit.Test)

Example 4 with ISOVField

use of org.jpos.iso.ISOVField 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 5 with ISOVField

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

the class VErrorParserTest method testGetVErrorsThrowsNullPointerException2.

@Test
public void testGetVErrorsThrowsNullPointerException2() throws Throwable {
    VErrorParser vErrorParser = new VErrorParser();
    ISOVField c = new ISOVField(new ISOField(), new ISOVError("testVErrorParserDescription"));
    c.addISOVError(null);
    try {
        vErrorParser.getVErrors(c);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ISOField(org.jpos.iso.ISOField) ISOVError(org.jpos.iso.ISOVError) ISOVField(org.jpos.iso.ISOVField) Test(org.junit.Test)

Aggregations

ISOField (org.jpos.iso.ISOField)5 ISOVField (org.jpos.iso.ISOVField)5 Test (org.junit.Test)5 Vector (java.util.Vector)2 ISOVError (org.jpos.iso.ISOVError)2 IFE_CHAR (org.jpos.iso.IFE_CHAR)1 ISOComponent (org.jpos.iso.ISOComponent)1 ISOException (org.jpos.iso.ISOException)1 ISOFieldPackager (org.jpos.iso.ISOFieldPackager)1 Logger (org.jpos.util.Logger)1