use of org.apache.directory.api.ldap.model.message.BindResponseImpl in project directory-ldap-api by apache.
the class BindResponseImplTest method testNotEqualsNewWithDiffId.
/**
* Tests to make sure newly created objects with same different id are not
* equal.
*/
@Test
public void testNotEqualsNewWithDiffId() {
BindResponseImpl resp0 = new BindResponseImpl(1);
BindResponseImpl resp1 = new BindResponseImpl(2);
assertFalse("different id objects should not be equal", resp0.equals(resp1));
assertFalse("different id objects should not be equal", resp1.equals(resp0));
}
use of org.apache.directory.api.ldap.model.message.BindResponseImpl in project directory-ldap-api by apache.
the class BindResponseImplTest method testEqualsSameObj.
/**
* Tests to make sure the same object returns true with equals().
*/
@Test
public void testEqualsSameObj() {
BindResponseImpl resp = new BindResponseImpl(1);
assertTrue("same object should be equal", resp.equals(resp));
}
use of org.apache.directory.api.ldap.model.message.BindResponseImpl in project directory-ldap-api by apache.
the class BindResponseImplTest method testNotEqualsNewWithDiffSaslCreds.
/**
* Tests to make sure newly created objects with same different saslCreds
* are not equal.
*/
@Test
public void testNotEqualsNewWithDiffSaslCreds() {
BindResponseImpl resp0 = new BindResponseImpl(1);
resp0.setServerSaslCreds(new byte[2]);
BindResponseImpl resp1 = new BindResponseImpl(1);
resp1.setServerSaslCreds(new byte[3]);
assertFalse("different serverSaslCreds objects should not be equal", resp0.equals(resp1));
assertFalse("different serverSaslCreds objects should not be equal", resp1.equals(resp0));
}
use of org.apache.directory.api.ldap.model.message.BindResponseImpl in project directory-ldap-api by apache.
the class BindResponseImplTest method testHashCodeNewWithSameId.
/**
* Tests to make sure newly created objects with same id have the same hashCode.
*/
@Test
public void testHashCodeNewWithSameId() {
BindResponseImpl resp0 = new BindResponseImpl(1);
BindResponseImpl resp1 = new BindResponseImpl(1);
assertTrue(resp1.hashCode() == resp0.hashCode());
}
use of org.apache.directory.api.ldap.model.message.BindResponseImpl in project directory-ldap-api by apache.
the class BindResponseImplTest method testHashCodeWithTheWorks.
/**
* Tests for equal hashCode of two fully loaded identical BindResponse PDUs.
*/
@Test
public void testHashCodeWithTheWorks() 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");
BindResponseImpl resp0 = new BindResponseImpl(1);
BindResponseImpl resp1 = new BindResponseImpl(1);
resp0.setServerSaslCreds(PASSWORD);
resp1.setServerSaslCreds(PASSWORD);
assertTrue(resp0.hashCode() == resp1.hashCode());
}
Aggregations