CompareRequest extends AbstractRequestMessage { @Override public String toString() { return new StringBuilder(super.toString()).append(", ") .append("dn=").append(ldapDn).append(", ") .append("attributeDesc=").append(attributeDesc).append(", ") .append("assertionValue=").append("userPassword".equals(attributeDesc) ? "<suppressed>" : assertionValue) .toString(); } private  CompareRequest();  CompareRequest(final String dn, final String name, final String value); String getDn(); String getName(); String getValue(); @Override String toString(); static Builder builder(); static final int PROTOCOL_OP; }
@Test public void testToString() { Assert.assertEquals( CompareRequest.builder().build().toString().split("::")[1], "controls=null, dn=null, attributeDesc=null, assertionValue=null"); Assert.assertEquals( new CompareRequest(null, null, null).toString().split("::")[1], "controls=null, dn=null, attributeDesc=null, assertionValue=null"); Assert.assertEquals( new CompareRequest("uid=1", null, null).toString().split("::")[1], "controls=null, dn=uid=1, attributeDesc=null, assertionValue=null"); Assert.assertEquals( new CompareRequest(null, "name", null).toString().split("::")[1], "controls=null, dn=null, attributeDesc=name, assertionValue=null"); Assert.assertEquals( new CompareRequest(null, null, "value").toString().split("::")[1], "controls=null, dn=null, attributeDesc=null, assertionValue=value"); Assert.assertEquals( new CompareRequest(null, "name", "value").toString().split("::")[1], "controls=null, dn=null, attributeDesc=name, assertionValue=value"); Assert.assertEquals( new CompareRequest(null, "userPassword", "password").toString().split("::")[1], "controls=null, dn=null, attributeDesc=userPassword, assertionValue=<suppressed>"); Assert.assertEquals( new CompareRequest("uid=1", "userPassword", "password").toString().split("::")[1], "controls=null, dn=uid=1, attributeDesc=userPassword, assertionValue=<suppressed>"); Assert.assertEquals( new CompareRequest("uid=1", "name", "value").toString().split("::")[1], "controls=null, dn=uid=1, attributeDesc=name, assertionValue=value"); }