use of com.beanit.asn1bean.compiler.tagging_test.ExplicitlyTaggedSequence in project jasn1 by openmuc.
the class TaggingTest method explicitlyTaggedSequenceIndefiniteTest.
@Test
public void explicitlyTaggedSequenceIndefiniteTest() throws Exception {
byte[] code = toBytes("BF218030800201010101FF00000000");
ExplicitlyTaggedSequence sequence = new ExplicitlyTaggedSequence();
InputStream is = new ByteArrayInputStream(code);
int numDecodedBytes = sequence.decode(is);
assertNotNull(sequence.getMyInteger());
assertNotNull(sequence.getMyBoolean());
assertEquals(-1, is.read());
assertEquals(code.length, numDecodedBytes);
}
use of com.beanit.asn1bean.compiler.tagging_test.ExplicitlyTaggedSequence in project jasn1 by openmuc.
the class TaggingTest method explicitlyTaggedSequenceTest.
@Test
public void explicitlyTaggedSequenceTest() throws Exception {
ExplicitlyTaggedSequence sequence = new ExplicitlyTaggedSequence();
sequence.setMyInteger(new BerInteger(1));
sequence.setMyBoolean(new BerBoolean(true));
ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(1000);
sequence.encode(os);
byte[] code = toBytes("BF210830060201010101FF");
assertArrayEquals(code, os.getArray());
sequence = new ExplicitlyTaggedSequence();
int numDecodedBytes = sequence.decode(new ByteArrayInputStream(os.getArray()));
assertNotNull(sequence.getMyInteger());
assertNotNull(sequence.getMyBoolean());
assertEquals(code.length, numDecodedBytes);
}
Aggregations