### Question:
AddRequestProtocolOp extends ProtocolOp { @Override public void write(ASN1Writer stream) throws IOException { stream.writeStartSequence(OP_TYPE_ADD_REQUEST); stream.writeOctetString(dn); stream.writeStartSequence(); for(RawAttribute attr : attributes) { attr.write(stream); } stream.writeEndSequence(); stream.writeEndSequence(); } AddRequestProtocolOp(ByteString dn);  AddRequestProtocolOp(ByteString dn, List<RawAttribute> attributes); ByteString getDN(); List<RawAttribute> getAttributes(); @Override byte getType(); @Override String getProtocolOpName(); @Override void write(ASN1Writer stream); @Override void toString(StringBuilder buffer); @Override void toString(StringBuilder buffer, int indent); void toLDIF(StringBuilder buffer, int wrapColumn);  }### Answer:
@Test(expectedExceptions = Exception.class) public void testNullEncodeDecode() throws Exception { ByteStringBuilder builder = new ByteStringBuilder(); ASN1Writer writer = ASN1.getWriter(builder); AddRequestProtocolOp addEncoded = new AddRequestProtocolOp(null, null); addEncoded.write(writer); ASN1Reader reader = ASN1.getReader(builder.toByteString()); AddRequestProtocolOp addDecoded = (AddRequestProtocolOp) LDAPReader.readProtocolOp(reader); assertEquals(addEncoded, addDecoded); }