* Tests decoding/encoding integers to/from byte array
*/
public void testDecode_Encode() throws IOException {
// oid decoder/encoder for testing
ASN1Integer asn1 = ASN1Integer.getInstance();
// decode from byte array
for (int i = 0; i < validTestcase.length; i++) {
DerInputStream in = new DerInputStream((byte[]) validTestcase[i][2]);
assertTrue((validTestcase[i][0]).toString(), // message
Arrays.equals((byte[]) validTestcase[i][1], // expected
(byte[]) asn1.decode(in))); // returned
}
// decode from input stream
for (int i = 0; i < validTestcase.length; i++) {
DerInputStream in = new DerInputStream(new ByteArrayInputStream(
(byte[]) validTestcase[i][2]));
assertTrue((validTestcase[i][0]).toString(), //message
Arrays.equals((byte[]) validTestcase[i][1], //expected
(byte[]) asn1.decode(in))); //returned
}
// encoding
for (int i = 0; i < validTestcase.length; i++) {
DerOutputStream out = new DerOutputStream(asn1, validTestcase[i][1]);