use of org.jpos.iso.ISOException in project jPOS by jpos.
the class VISA1PackagerTest method testUnpackThrowsISOException1.
@Test
public void testUnpackThrowsISOException1() throws Throwable {
int[] sequence = new int[3];
VISA1Packager vISA1Packager = new VISA1Packager(sequence, 100, "testVISA1PackagerBadResultCode", "testVISA1PackagerOkPattern");
byte[] b = new byte[3];
try {
vISA1Packager.unpack(new ISOBitMap(100), 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());
assertSame("vISA1Packager.filter", vISA1Packager, vISA1Packager.filter);
}
}
use of org.jpos.iso.ISOException in project jPOS by jpos.
the class VISA1PackagerTest method testUnpackThrowsISOException.
@Test
public void testUnpackThrowsISOException() throws Throwable {
int[] sequence = new int[2];
VISA1Packager vISA1Packager = new VISA1Packager(sequence, 100, "testVISA1PackagerBadResultCode", "testVISA1PackagerOkPattern");
byte[] bytes = new byte[3];
try {
vISA1Packager.unpack(new ISOMsg(100), new ByteArrayInputStream(bytes));
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "not implemented", ex.getMessage());
assertNull("ex.getNested()", ex.getNested());
}
}
use of org.jpos.iso.ISOException in project jPOS by jpos.
the class X92GenericPackagerTest method testConstructorThrowsISOException.
@Test
public void testConstructorThrowsISOException() throws Throwable {
byte[] bytes = new byte[1];
try {
new X92GenericPackager(new ByteArrayInputStream(bytes));
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getNested().getClass()", SAXParseException.class, ex.getNested().getClass());
assertEquals("ex.getNested().getMessage()", "Content is not allowed in prolog.", ex.getNested().getMessage());
}
}
use of org.jpos.iso.ISOException in project jPOS by jpos.
the class XMLPackagerTest method testPackException.
@Test
public void testPackException() {
ISOField field = new ISOField();
try {
xMLPackager.pack(field);
fail("Exception Expected - not an isomsg");
} catch (ISOException e) {
assertThat(e.getMessage(), is("cannot pack class org.jpos.iso.ISOField"));
}
}
use of org.jpos.iso.ISOException in project jPOS by jpos.
the class MSGTEST021Test method testValidateThrowsISOException.
@Test
public void testValidateThrowsISOException() throws Throwable {
try {
new MSGTEST02().validate(new ISOField());
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "Can't call validate on non Composite", ex.getMessage());
assertNull("ex.getNested()", ex.getNested());
}
}
Aggregations