use of es.gob.jmulticard.asn1.Asn1Exception in project jmulticard by ctt-gob-es.
the class TestDerBoolean method testGetBytes.
/**
* Test method for {@link es.gob.jmulticard.asn1.DecoderObject#getBytes()}.
* @throws TlvException Si no se puede crear el TLV.
* @throws Asn1Exception Si falla la creación del tipo ASN1.
*/
public static final void testGetBytes() throws Asn1Exception, TlvException {
final DerBoolean db = new DerBoolean();
db.setDerValue(new byte[] { (byte) 0x01, (byte) 0x01, (byte) 0x00 });
// $NON-NLS-1$
Assert.assertEquals("010100", HexUtils.hexify(db.getBytes(), false));
}
use of es.gob.jmulticard.asn1.Asn1Exception in project jmulticard by ctt-gob-es.
the class TestDerBoolean method testCheckTagWithWrongTagMustThrowException.
/**
* Test method for {@link es.gob.jmulticard.asn1.DecoderObject#checkTag(byte)}.
*/
public static final void testCheckTagWithWrongTagMustThrowException() {
try {
final DerBoolean db = new DerBoolean();
db.checkTag((byte) 0x02);
} catch (final Exception e) {
if (!(e instanceof Asn1Exception)) {
// $NON-NLS-1$ //$NON-NLS-2$
Assert.fail("Se esperaba " + Asn1Exception.class.getName() + " pero se obtuvo " + e.getClass().getName());
}
}
}
Aggregations