use of org.jpos.iso.IVA_ALPHANUMNOZERO_NOBLANK in project jPOS by jpos.
the class GenericValidatingPackagerTest method testValidate1.
@Test
public void testValidate1() throws Throwable {
GenericValidatingPackager genericValidatingPackager = new GenericValidatingPackager();
ISOFieldValidator[] fvlds = new ISOFieldValidator[2];
fvlds[0] = new ISOFieldValidator();
fvlds[1] = new IVA_ALPHANUMNOZERO_NOBLANK();
genericValidatingPackager.setFieldValidator(fvlds);
ISOBaseValidator[] msgVlds = new ISOBaseValidator[2];
msgVlds[0] = new MSGTEST();
msgVlds[1] = new ISOBaseValidator();
genericValidatingPackager.setMsgValidator(msgVlds);
ISOMsg m = new ISOMsg("testGenericValidatingPackagerMti");
m.setMTI("testGenericValidatingPackagerMti");
ISOVMsg result = (ISOVMsg) genericValidatingPackager.validate(m);
assertNotNull("result", result);
}
use of org.jpos.iso.IVA_ALPHANUMNOZERO_NOBLANK in project jPOS by jpos.
the class ISOBaseValidatingPackagerTest method testValidateThrowsISOException5.
@Test
public void testValidateThrowsISOException5() throws Throwable {
ISOValidator[] fvlds = new ISOValidator[1];
fvlds[0] = new IVA_ALPHANUMNOZERO_NOBLANK();
ISOBaseValidatingPackager iSOBaseValidatingPackager = new ISOBaseValidatingPackager();
iSOBaseValidatingPackager.setFieldValidator(fvlds);
ISOBaseValidator[] msgVlds = new ISOBaseValidator[2];
msgVlds[1] = new TEST0100();
iSOBaseValidatingPackager.setMsgValidator(msgVlds);
try {
iSOBaseValidatingPackager.validate(new ISOMsg());
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "MTI not available", ex.getMessage());
assertNull("ex.getNested()", ex.getNested());
}
}
use of org.jpos.iso.IVA_ALPHANUMNOZERO_NOBLANK in project jPOS by jpos.
the class GenericValidatingPackagerTest method testGenericValidatorContentHandlerMakeFieldValidatorArrayThrowsClassCastException1.
@SuppressWarnings("unchecked")
@Test
public void testGenericValidatorContentHandlerMakeFieldValidatorArrayThrowsClassCastException1() throws Throwable {
GenericValidatingPackager.GenericValidatorContentHandler genericValidatorContentHandler = new GenericValidatingPackager().new GenericValidatorContentHandler();
Map hashMap = new HashMap();
hashMap.put("", "testString");
Hashtable tab = new Hashtable(hashMap);
tab.put(Integer.valueOf(100), new IVA_ALPHANUMNOZERO_NOBLANK(true, "testGenericValidatorContentHandlerDescription"));
try {
genericValidatorContentHandler.makeFieldValidatorArray(tab);
fail("Expected ClassCastException to be thrown");
} catch (ClassCastException ex) {
assertEquals("ex.getClass()", ClassCastException.class, ex.getClass());
assertEquals("tab.size()", 2, tab.size());
}
}
Aggregations