use of org.jpos.iso.ISOFieldValidator in project jPOS by jpos.
the class GenericValidatingPackagerTest method testGenericValidatorContentHandlerMakeFieldValidatorArray2.
@SuppressWarnings("unchecked")
@Test
public void testGenericValidatorContentHandlerMakeFieldValidatorArray2() throws Throwable {
GenericValidatingPackager.GenericValidatorContentHandler genericValidatorContentHandler = new GenericValidatingPackager().new GenericValidatorContentHandler();
Hashtable tab = new Hashtable(100);
tab.put(Integer.valueOf(-2), new IVA_ALPHANUMNOBLANK("testGenericValidatorContentHandlerDescription"));
tab.put(Integer.valueOf(-4), new IVA_ALPHANUMNOBLANK(100, 1000, "testGenericValidatorContentHandlerDescription"));
ISOFieldValidator[] result = genericValidatorContentHandler.makeFieldValidatorArray(tab);
assertEquals("result.length", 2, result.length);
}
use of org.jpos.iso.ISOFieldValidator in project jPOS by jpos.
the class GenericValidatingPackagerTest method testValidateThrowsNullPointerException.
@Test
public void testValidateThrowsNullPointerException() throws Throwable {
GenericValidatingPackager genericValidatingPackager = new GenericValidatingPackager();
ISOFieldValidator[] fvlds = new ISOFieldValidator[0];
genericValidatingPackager.setFieldValidator(fvlds);
ISOBaseValidator[] msgVlds = new ISOBaseValidator[2];
msgVlds[0] = new ISOBaseValidator();
msgVlds[1] = new MSGTEST02();
genericValidatingPackager.setMsgValidator(msgVlds);
try {
genericValidatingPackager.validate(new ISOMsg());
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
}
}
use of org.jpos.iso.ISOFieldValidator in project jPOS by jpos.
the class GenericValidatingPackagerTest method testGenericValidatorContentHandlerMakeFieldValidatorArray1.
@SuppressWarnings("unchecked")
@Test
public void testGenericValidatorContentHandlerMakeFieldValidatorArray1() throws Throwable {
GenericValidatingPackager.GenericValidatorContentHandler genericValidatorContentHandler = new GenericValidatingPackager().new GenericValidatorContentHandler();
Hashtable tab = new Properties();
tab.put(Integer.valueOf(-4), new IVA_ALPHANUMNOBLANK(true, "testGenericValidatorContentHandlerDescription"));
ISOFieldValidator[] result = genericValidatorContentHandler.makeFieldValidatorArray(tab);
assertEquals("result.length", 1, result.length);
}
use of org.jpos.iso.ISOFieldValidator in project jPOS by jpos.
the class GenericValidatingPackagerTest method testValidateThrowsISOVException.
@Test
public void testValidateThrowsISOVException() throws Throwable {
GenericValidatingPackager genericValidatingPackager = new GenericValidatingPackager();
ISOBaseValidator[] msgVlds = new ISOBaseValidator[3];
msgVlds[0] = new MSGTEST(false);
msgVlds[1] = new MSGTEST(true);
genericValidatingPackager.setMsgValidator(msgVlds);
ISOFieldValidator[] fvlds = new ISOFieldValidator[1];
fvlds[0] = new IVA_ALPHANUM("testGenericValidatingPackagerDescription");
genericValidatingPackager.setFieldValidator(fvlds);
try {
genericValidatingPackager.validate(new ISOMsg(100));
fail("Expected ISOVException to be thrown");
} catch (ISOVException ex) {
assertEquals("ex.getMessage()", "Error on msg. ", ex.getMessage());
assertFalse("ex.treated()", ex.treated());
assertNotNull("ex.getErrComponent()", ex.getErrComponent());
assertNull("ex.getNested()", ex.getNested());
}
}
use of org.jpos.iso.ISOFieldValidator in project jPOS by jpos.
the class ISOBaseValidatingPackagerTest method testValidate18.
@Test
public void testValidate18() throws Throwable {
ISOBaseValidator[] msgVlds = new ISOBaseValidator[2];
msgVlds[0] = new TEST0100(true);
msgVlds[1] = new MSGTEST();
ISOBaseValidatingPackager iSOBaseValidatingPackager = new ISOBaseValidatingPackager();
iSOBaseValidatingPackager.setMsgValidator(msgVlds);
ISOValidator[] fvlds = new ISOValidator[5];
fvlds[1] = new ISOFieldValidator();
iSOBaseValidatingPackager.setFieldValidator(fvlds);
ISOVMsg result = (ISOVMsg) iSOBaseValidatingPackager.validate(new ISOMsg("testISOBaseValidatingPackagerMti"));
assertNotNull("result", result);
}
Aggregations