Search in sources :

Example 1 with ExplicitlyTaggedSet

use of org.openmuc.jasn1.compiler.tagging_test.ExplicitlyTaggedSet in project jasn1 by openmuc.

the class TaggingTest method explicitlyTaggedSetTest.

@Test
public void explicitlyTaggedSetTest() throws Exception {
    ExplicitlyTaggedSet set = new ExplicitlyTaggedSet();
    set.setMyInteger(new BerInteger(1));
    set.setMyBoolean(new BerBoolean(true));
    ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(1000);
    set.encode(os);
    Assert.assertArrayEquals(DatatypeConverter.parseHexBinary("BF210831060201010101FF"), os.getArray());
    set = new ExplicitlyTaggedSet();
    set.decode(new ByteArrayInputStream(os.getArray()));
    Assert.assertNotNull(set.getMyInteger());
    Assert.assertNotNull(set.getMyBoolean());
}
Also used : ExplicitlyTaggedSet(org.openmuc.jasn1.compiler.tagging_test.ExplicitlyTaggedSet) BerBoolean(org.openmuc.jasn1.ber.types.BerBoolean) ByteArrayInputStream(java.io.ByteArrayInputStream) BerInteger(org.openmuc.jasn1.ber.types.BerInteger) ReverseByteArrayOutputStream(org.openmuc.jasn1.ber.ReverseByteArrayOutputStream) Test(org.junit.Test)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 Test (org.junit.Test)1 ReverseByteArrayOutputStream (org.openmuc.jasn1.ber.ReverseByteArrayOutputStream)1 BerBoolean (org.openmuc.jasn1.ber.types.BerBoolean)1 BerInteger (org.openmuc.jasn1.ber.types.BerInteger)1 ExplicitlyTaggedSet (org.openmuc.jasn1.compiler.tagging_test.ExplicitlyTaggedSet)1