use of org.jpos.iso.ISOAmount in project jPOS by jpos.
the class CheckFieldsTest method testAmounts.
@Test
public void testAmounts() throws ISOException {
Context ctx = new Context();
ISOMsg m = new ISOMsg();
ISOAmount local = new ISOAmount(4, 858, new BigDecimal("290.00"));
ISOAmount settlement = new ISOAmount(5, 840, new BigDecimal("10.00"));
m.set(local);
m.set(settlement);
ctx.put(ContextConstants.REQUEST.toString(), m);
cfg.put("mandatory", "AMOUNT");
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());
assertEquals(local, ctx.get(ContextConstants.LOCAL_AMOUNT.toString()));
assertEquals(settlement, ctx.get(ContextConstants.AMOUNT.toString()));
}