### Question:
Asn1Object { public DerParser getParser() throws IOException { if (!isConstructed()) { throw new IOException("Invalid DER: can't parse primitive entity"); } return new DerParser(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 testGetParser() throws Exception { byte[] testValue = {0x00, 0x01, 0x02, 0x03, 0x04}; Asn1Object asn1Object = new Asn1Object(DerParser.NUMERIC_STRING | DER_CONSTRUCTED, 5, testValue); assertTrue(asn1Object.getParser() instanceof DerParser); }
@Test(expected=IOException.class) public void testGetParserNotConstructed() throws Exception { byte[] testValue = {0x00, 0x01, 0x02, 0x03, 0x04}; Asn1Object asn1Object = new Asn1Object(DerParser.NUMERIC_STRING, 5, testValue); asn1Object.getParser(); }