use of org.jpos.util.Logger in project jPOS by jpos.
the class CTCSubElementPackagerTest method testUnpackThrowsISOException.
@Test
public void testUnpackThrowsISOException() throws Throwable {
CTCSubElementPackager cTCSubElementPackager = new CTCSubElementPackager();
ISOFieldPackager[] fld = new ISOFieldPackager[2];
cTCSubElementPackager.setFieldPackager(fld);
cTCSubElementPackager.setLogger(new Logger(), "testCTCSubElementPackagerRealm");
cTCSubElementPackager.setFieldPackager(0, new IFE_CHAR());
byte[] b = new byte[2];
try {
cTCSubElementPackager.unpack(new ISOVField(new ISOField(100, "testCTCSubElementPackagerv"), null), 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());
}
}
use of org.jpos.util.Logger in project jPOS by jpos.
the class GenericSubFieldPackagerTest method testReturnsZero.
@Test
public void testReturnsZero() throws Throwable {
byte[] b = new byte[0];
GenericSubFieldPackager genericSubFieldPackager = new GenericSubFieldPackager();
genericSubFieldPackager.setLogger(new Logger(), "testGenericSubFieldPackagerRealm");
int l = genericSubFieldPackager.unpack(new ISOMsg("testGenericSubFieldPackagerMti"), b);
assertEquals(0L, (long) l);
}
use of org.jpos.util.Logger in project jPOS by jpos.
the class GenericSubFieldPackagerTest method testUnpackReturnsZero1.
@Test
public void testUnpackReturnsZero1() throws Throwable {
byte[] b = new byte[0];
ISOFieldPackager[] fld = new ISOFieldPackager[0];
GenericSubFieldPackager genericSubFieldPackager = new GenericSubFieldPackager();
genericSubFieldPackager.setFieldPackager(fld);
genericSubFieldPackager.setLogger(new Logger(), "testGenericSubFieldPackagerRealm");
int l = genericSubFieldPackager.unpack(new ISOMsg("testGenericSubFieldPackagerMti"), b);
assertEquals(0L, (long) l);
}
use of org.jpos.util.Logger in project jPOS by jpos.
the class PostPackagerTest method testSetLogger.
@Test
public void testSetLogger() throws Throwable {
PostPackager postPackager = new PostPackager();
Logger logger = Logger.getLogger("testPostPackagerName");
postPackager.setLogger(logger, "testPostPackagerRealm");
assertNotNull("postPackager.p127", postPackager.p127);
assertSame("postPackager.getLogger()", logger, postPackager.getLogger());
assertEquals("postPackager.getRealm()", "testPostPackagerRealm", postPackager.getRealm());
}
use of org.jpos.util.Logger in project jPOS by jpos.
the class BaseSMAdapterTest method testTranslatePINImplThrowsSMException1.
@Test
public void testTranslatePINImplThrowsSMException1() throws Throwable {
BaseSMAdapter baseSMAdapter = new BaseSMAdapter(new SubConfiguration(new SimpleConfiguration(new Properties(null)), "testBaseSMAdapterPrefix"), new Logger(), "testBaseSMAdapterRealm");
try {
baseSMAdapter.translatePINImpl(new EncryptedPIN(), new SecureDESKey((short) 100, "testBaseSMAdapterKeyType", "testBaseSMAdapterKeyHexString1", "testBaseSMAdapterKeyCheckValueHexString1"), new SecureDESKey(), (byte) 0);
fail("Expected SMException to be thrown");
} catch (SMException ex) {
assertEquals("ex.getMessage()", "Operation not supported in: org.jpos.security.BaseSMAdapter", ex.getMessage());
assertNull("ex.nested", ex.nested);
assertNull("ex.getNested()", ex.getNested());
}
}
Aggregations