### Question:
Asn1Object { public BigInteger getInteger() throws IOException { if (type != DerParser.INTEGER) { throw new IOException("Invalid DER: object is not integer"); } return new BigInteger(value); } Asn1Object(int tag, int length, byte[] value); int getType(); int getLength(); byte[] getValue(); boolean isConstructed(); DerParser getParser(); BigInteger getInteger(); String getString();  }### Answer:
@Test public void testGetInteger() throws Exception { byte[] testValue = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; Asn1Object asn1Object = new Asn1Object(DerParser.INTEGER, 8, testValue); BigInteger testBigInteger = asn1Object.getInteger(); assertTrue(Arrays.equals(testValue, testBigInteger.toByteArray())); }
@Test(expected=IOException.class) public void testGetIntegerNotInteger() throws Exception { byte[] testValue = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; Asn1Object asn1Object = new Asn1Object(DerParser.GENERAL_STRING, 8, testValue); BigInteger testBigInteger = asn1Object.getInteger(); }