use of org.jpos.rc.Result in project jPOS by jpos.
the class CheckFieldsTest method testMandatoryPCodeNotPresent.
@Test
public void testMandatoryPCodeNotPresent() {
Context ctx = new Context();
ISOMsg m = new ISOMsg();
ctx.put(ContextConstants.REQUEST.toString(), m);
cfg.put("mandatory", "3");
int action = cf.prepare(1L, ctx);
assertEquals("Action should be ABORTED|NO_JOIN|READONLY", ABORTED | NO_JOIN | READONLY, action);
Result rc = ctx.getResult();
assertFalse("RC should have no info", rc.hasInfo());
assertFalse("RC should have no warnings", rc.hasWarnings());
assertTrue("RC should have failures", rc.hasFailures());
assertEquals("IRC should be MISSING_FIELD", CMF.MISSING_FIELD, rc.failure().getIrc());
}
use of org.jpos.rc.Result in project jPOS by jpos.
the class CheckFieldsTest method testOptionalPCodeNotPresent.
@Test
public void testOptionalPCodeNotPresent() {
Context ctx = new Context();
ISOMsg m = new ISOMsg();
ctx.put(ContextConstants.REQUEST.toString(), m);
int action = cf.prepare(1L, ctx);
assertEquals("Action should be PREPARED|NO_JOIN|READONLY", PREPARED | NO_JOIN | READONLY, action);
Result rc = ctx.getResult();
assertFalse("RC should have no info", rc.hasInfo());
assertFalse("RC should have no warnings", rc.hasWarnings());
assertFalse("RC should have no failures", rc.hasFailures());
}
use of org.jpos.rc.Result in project jPOS by jpos.
the class CheckFieldsTest method testInvalidPCode.
@Test
public void testInvalidPCode() {
Context ctx = new Context();
ISOMsg m = new ISOMsg();
m.set(3, "*00000");
m.set(11, "000001");
ctx.put(ContextConstants.REQUEST.toString(), m);
cfg.put("optional", "PCODE");
int action = cf.prepare(1L, ctx);
assertEquals("Action should be ABORTED|NO_JOIN|READONLY", ABORTED | NO_JOIN | READONLY, action);
Result rc = ctx.getResult();
assertEquals(CMF.INVALID_FIELD, rc.failure().getIrc());
assertFalse(rc.hasInfo());
assertFalse(rc.hasWarnings());
assertTrue(rc.hasFailures());
assertTrue(rc.failure().getMessage().startsWith("Invalid PCODE"));
}
use of org.jpos.rc.Result in project jPOS by jpos.
the class CheckFieldsTest method testGenericFieldsOptionalNotPresent.
@Test
public void testGenericFieldsOptionalNotPresent() {
Context ctx = new Context();
ISOMsg m = new ISOMsg();
m.set(48, "Mandatory field 48");
ctx.put(ContextConstants.REQUEST.toString(), m);
cfg.put("mandatory", "48");
cfg.put("optional", "60");
int action = cf.prepare(1L, ctx);
assertEquals(PREPARED | NO_JOIN | READONLY, action);
Result rc = ctx.getResult();
assertFalse(rc.hasInfo());
assertFalse(rc.hasWarnings());
assertFalse(rc.hasFailures());
}
use of org.jpos.rc.Result in project jPOS by jpos.
the class SelectDestinationTest method testNetwork6.
@Test
public void testNetwork6() {
cfg.put("ignore-luhn", "true");
p.setConfiguration(cfg);
Context ctx = new Context();
ctx.put(ContextConstants.REQUEST.toString(), createISOMsg("6111111111111111"));
int action = p.prepare(1L, ctx);
assertEquals("Action should be PREPARED|NO_JOIN|READONLY", PREPARED | NO_JOIN | READONLY, action);
Result rc = ctx.getResult();
assertFalse("No failures", rc.hasFailures());
assertEquals("Invalid Destination", "N6", ctx.getString(DESTINATION.toString()));
}
Aggregations