Search in sources :

Example 1 with RetaggedUntaggedChoice

use of com.beanit.asn1bean.compiler.tagging_test.RetaggedUntaggedChoice in project jasn1 by openmuc.

the class TaggingTest method retaggedChoiceTest.

@Test
public void retaggedChoiceTest() throws Exception {
    RetaggedUntaggedChoice choice = new RetaggedUntaggedChoice();
    choice.setMyInteger(new BerInteger(1));
    ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(1000);
    choice.encode(os);
    assertArrayEquals(toBytes("BF2103830101"), os.getArray());
    choice = new RetaggedUntaggedChoice();
    choice.decode(new ByteArrayInputStream(os.getArray()));
    assertNotNull(choice.getMyInteger());
    assertNull(choice.getMyBoolean());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) RetaggedUntaggedChoice(com.beanit.asn1bean.compiler.tagging_test.RetaggedUntaggedChoice) BerInteger(com.beanit.asn1bean.ber.types.BerInteger) ReverseByteArrayOutputStream(com.beanit.asn1bean.ber.ReverseByteArrayOutputStream) Test(org.junit.jupiter.api.Test)

Aggregations

ReverseByteArrayOutputStream (com.beanit.asn1bean.ber.ReverseByteArrayOutputStream)1 BerInteger (com.beanit.asn1bean.ber.types.BerInteger)1 RetaggedUntaggedChoice (com.beanit.asn1bean.compiler.tagging_test.RetaggedUntaggedChoice)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 Test (org.junit.jupiter.api.Test)1