### Question:
ModifyDNRequestProtocolOp extends ProtocolOp { public void toString(StringBuilder buffer) { buffer.append("ModifyDNRequest(dn=").append(entryDN); buffer.append(", newRDN=").append(newRDN); buffer.append(", deleteOldRDN=").append(deleteOldRDN); if (newSuperior != null) { buffer.append(", newSuperior=").append(newSuperior); } buffer.append(")"); } ModifyDNRequestProtocolOp(ByteString entryDN,
                                   ByteString newRDN, boolean deleteOldRDN);  ModifyDNRequestProtocolOp(ByteString entryDN,
                                   ByteString newRDN, boolean deleteOldRDN,
                                   ByteString newSuperior); ByteString getEntryDN(); ByteString getNewRDN(); boolean deleteOldRDN(); ByteString getNewSuperior(); byte getType(); String getProtocolOpName(); void write(ASN1Writer stream); void toString(StringBuilder buffer); void toString(StringBuilder buffer, int indent);  }### Answer:
@Test public void TestToStringSingleLine() throws Exception { ModifyDNRequestProtocolOp modifyRequest; StringBuilder buffer = new StringBuilder(); StringBuilder key = new StringBuilder(); modifyRequest = new ModifyDNRequestProtocolOp(dn, newRdn, true, newSuperiorDn); modifyRequest.toString(buffer); key.append("ModifyDNRequest(dn=").append(dn).append(", newRDN=").append(newRdn).append(", ").append("deleteOldRDN=").append(true).append(", newSuperior=") .append(newSuperiorDn).append(")"); assertEquals(buffer.toString(), key.toString()); }
@Test public void TestToStringMultiLine() throws Exception { ModifyDNRequestProtocolOp modifyRequest; StringBuilder buffer = new StringBuilder(); StringBuilder key = new StringBuilder(); int i; int indent; indent = 5; modifyRequest = new ModifyDNRequestProtocolOp(dn, newRdn, true, newSuperiorDn); modifyRequest.toString(buffer, indent); StringBuilder indentBuf = new StringBuilder(indent); for (i=0 ; i < indent; i++) { indentBuf.append(' '); } key.append(indentBuf); key.append("Modify DN Request"); key.append(EOL); key.append(indentBuf); key.append(" Entry DN: "); key.append(dn); key.append(EOL); key.append(indentBuf); key.append(" New RDN: "); key.append(newRdn); key.append(EOL); key.append(indentBuf); key.append(" Delete Old RDN: "); key.append(true); key.append(EOL); key.append(indentBuf); key.append(" New Superior: "); key.append(newSuperiorDn); key.append(EOL); assertEquals(buffer.toString(), key.toString()); }