IntegerType extends AbstractDERType implements DEREncoder { @Override public byte[] encode() { return encode(derItem); } IntegerType(final BigInteger item);  IntegerType(final int item);  IntegerType(final DERTag tag, final BigInteger item);  IntegerType(final DERTag tag, final int item); @Override byte[] encode(); static BigInteger decode(final DERBuffer encoded); static BigInteger decodeUnsigned(final DERBuffer encoded); static int decodeUnsignedPrimitive(final DERBuffer encoded); static byte[] toBytes(final BigInteger i);  }
@Test(groups = "asn1", dataProvider = "ints") public void encode( final byte[] expected, final BigInteger integer, final BigInteger unsigned, final int unsignedPrim) throws Exception { if (integer.intValue() == -1 && expected.length > 1) { Assert.assertTrue(expected.length > 1); } else { Assert.assertEquals(IntegerType.toBytes(integer), expected); } }