Search in sources :

Example 1 with DerBoolean

use of es.gob.jmulticard.asn1.der.DerBoolean 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));
}
Also used : DerBoolean(es.gob.jmulticard.asn1.der.DerBoolean)

Example 2 with DerBoolean

use of es.gob.jmulticard.asn1.der.DerBoolean 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());
        }
    }
}
Also used : DerBoolean(es.gob.jmulticard.asn1.der.DerBoolean) Asn1Exception(es.gob.jmulticard.asn1.Asn1Exception) TlvException(es.gob.jmulticard.asn1.TlvException) Asn1Exception(es.gob.jmulticard.asn1.Asn1Exception)

Aggregations

DerBoolean (es.gob.jmulticard.asn1.der.DerBoolean)2 Asn1Exception (es.gob.jmulticard.asn1.Asn1Exception)1 TlvException (es.gob.jmulticard.asn1.TlvException)1