Search in sources :

Example 1 with RetaggedUntaggedChoice

use of org.openmuc.jasn1.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);
    Assert.assertArrayEquals(DatatypeConverter.parseHexBinary("BF2103830101"), os.getArray());
    choice = new RetaggedUntaggedChoice();
    choice.decode(new ByteArrayInputStream(os.getArray()));
    Assert.assertNotNull(choice.getMyInteger());
    Assert.assertNull(choice.getMyBoolean());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) RetaggedUntaggedChoice(org.openmuc.jasn1.compiler.tagging_test.RetaggedUntaggedChoice) 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 RetaggedUntaggedChoice (org.openmuc.jasn1.compiler.tagging_test.RetaggedUntaggedChoice)1