use of org.apache.directory.api.ldap.model.message.LdapResultImpl in project directory-ldap-api by apache.
the class LdapResultImplTest method testEqualsDefaultCopy.
/**
* Tests to make sure a default LdapResultImpl equals another one just
* created.
*/
@Test
public void testEqualsDefaultCopy() {
LdapResultImpl r0 = new LdapResultImpl();
LdapResultImpl r1 = new LdapResultImpl();
assertTrue("default copy should be equal", r0.equals(r1));
assertTrue("default copy should be equal", r1.equals(r0));
}
use of org.apache.directory.api.ldap.model.message.LdapResultImpl in project directory-ldap-api by apache.
the class LdapResultImplTest method testEqualsSameObj.
/**
* Tests to make sure the two same objects are seen as equal.
*/
@Test
public void testEqualsSameObj() {
LdapResultImpl r0 = new LdapResultImpl();
assertTrue("same object should be equal", r0.equals(r0));
}
use of org.apache.directory.api.ldap.model.message.LdapResultImpl in project directory-ldap-api by apache.
the class LdapResultImplTest method testNotEqualsDiffErrorMessage.
/**
* Tests for inequality when the error message is different.
*/
@Test
public void testNotEqualsDiffErrorMessage() throws LdapException {
LdapResultImpl r0 = new LdapResultImpl();
LdapResultImpl r1 = new LdapResultImpl();
r0.setDiagnosticMessage("blah blah blah");
r1.setDiagnosticMessage("blah");
r0.setMatchedDn(new Dn("dc=example,dc=com"));
r1.setMatchedDn(new Dn("dc=example,dc=com"));
r0.setResultCode(ResultCodeEnum.TIME_LIMIT_EXCEEDED);
r1.setResultCode(ResultCodeEnum.TIME_LIMIT_EXCEEDED);
Referral refs0 = new ReferralImpl();
refs0.addLdapUrl("ldap://someserver.com");
refs0.addLdapUrl("ldap://anotherserver.org");
Referral refs1 = new ReferralImpl();
refs1.addLdapUrl("ldap://someserver.com");
refs1.addLdapUrl("ldap://anotherserver.org");
assertFalse("results with different error messages should " + "not be equal", r0.equals(r1));
assertFalse("results with different error messages should " + "not be equal", r1.equals(r0));
}
use of org.apache.directory.api.ldap.model.message.LdapResultImpl in project directory-ldap-api by apache.
the class LdapResultImplTest method testHashCodeCarbonCopy.
/**
* Tests two non default carbon copies for equal hashCode.
*/
@Test
public void testHashCodeCarbonCopy() throws LdapException {
LdapResultImpl r0 = new LdapResultImpl();
LdapResultImpl r1 = new LdapResultImpl();
r0.setDiagnosticMessage("blah blah blah");
r1.setDiagnosticMessage("blah blah blah");
r0.setMatchedDn(new Dn("dc=example,dc=com"));
r1.setMatchedDn(new Dn("dc=example,dc=com"));
r0.setResultCode(ResultCodeEnum.TIME_LIMIT_EXCEEDED);
r1.setResultCode(ResultCodeEnum.TIME_LIMIT_EXCEEDED);
Referral refs0 = new ReferralImpl();
refs0.addLdapUrl("ldap://someserver.com");
refs0.addLdapUrl("ldap://anotherserver.org");
Referral refs1 = new ReferralImpl();
refs1.addLdapUrl("ldap://someserver.com");
refs1.addLdapUrl("ldap://anotherserver.org");
assertTrue(r0.hashCode() == r1.hashCode());
}
use of org.apache.directory.api.ldap.model.message.LdapResultImpl in project directory-ldap-api by apache.
the class LdapResultImplTest method testEqualsDiffLockableParent.
/**
* Tests for equality when the lockable parent is not the same.
*/
@Test
public void testEqualsDiffLockableParent() {
LdapResultImpl r0 = new LdapResultImpl();
LdapResultImpl r1 = new LdapResultImpl();
assertTrue("default copy with different lockable parents " + "should be equal", r0.equals(r1));
assertTrue("default copy with different lockable parents " + "should be equal", r1.equals(r0));
}
Aggregations