Search in sources :

Example 1 with ExplicitlyTaggedSetOf

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

the class TaggingTest method explicitlyTaggedSetOfTest.

@Test
public void explicitlyTaggedSetOfTest() throws Exception {
    ExplicitlyTaggedSetOf setOf = new ExplicitlyTaggedSetOf();
    List<BerInteger> integerList = setOf.getBerInteger();
    integerList.add(new BerInteger(3));
    integerList.add(new BerInteger(4));
    ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(1000);
    setOf.encode(os);
    System.out.println("setOf : " + DatatypeConverter.printHexBinary(os.getArray()));
    Assert.assertArrayEquals(DatatypeConverter.parseHexBinary("BF21083106020103020104"), os.getArray());
    setOf = new ExplicitlyTaggedSetOf();
    setOf.decode(new ByteArrayInputStream(os.getArray()));
}
Also used : ExplicitlyTaggedSetOf(org.openmuc.jasn1.compiler.tagging_test.ExplicitlyTaggedSetOf) 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 BerInteger (org.openmuc.jasn1.ber.types.BerInteger)1 ExplicitlyTaggedSetOf (org.openmuc.jasn1.compiler.tagging_test.ExplicitlyTaggedSetOf)1