Policy p1 = new Policy();
p1.setId("abcd");
// same cd
CallDescriptor cd_p1 = new CallDescriptor(p1, -1, -1);
assertThat(cd_p1, is(cd_p1));
// different cd with same non-null policy
CallDescriptor cd2_p1 = new CallDescriptor(p1, -1, -1);
assertThat(cd2_p1, is(cd_p1));
// same non-null policy, different bucket id
CallDescriptor cd_p1_bucket = new CallDescriptor(p1, 0, -1);
assertThat(cd_p1_bucket, is(not(cd_p1)));
// same non-null policy, different context id
CallDescriptor cd_p1_context = new CallDescriptor(p1, -1, 0);
assertThat(cd_p1_context, is(not(cd_p1)));
// same non-null policy, different bucket & bucket id
CallDescriptor cd_p1_ctx_buck = new CallDescriptor(p1, 0, 0);
assertThat(cd_p1, is(not(cd_p1_ctx_buck)));
// comparing with non null policy but null policy id
Policy p_idn = new Policy();
CallDescriptor cd_pn_idn = new CallDescriptor(p_idn, -1, -1);
assertThat(cd_p1, is(not(cd_pn_idn)));
// comparing with non null policy but null policy id
CallDescriptor cd_pn_idn_bucket = new CallDescriptor(p_idn, 0, -1);
assertThat(cd_p1, is(not(cd_pn_idn_bucket)));
// comparing with non null policy but null policy id
CallDescriptor cd_pn_idn_context = new CallDescriptor(p_idn, -1, 0);
assertThat(cd_p1, is(not(cd_pn_idn_context)));
// comparing with null policy
CallDescriptor cd_pn = new CallDescriptor(null, -1, -1);
assertThat(cd_p1, is(not(cd_pn)));
assertThat(cd_pn, is(not(cd_p1)));
// comparing 2 null policies
CallDescriptor cd2_pn = new CallDescriptor(null, -1, -1);
assertThat(cd_pn, is(cd2_pn));
// comparing with different policy but same policy id
Policy p2 = new Policy();
p2.setId("abcd");
// different policy with same id
CallDescriptor cd2_p2 = new CallDescriptor(p2, -1, -1);
assertThat(cd2_p2, is(cd_p1));
// different policy with same id + different bucket id
CallDescriptor cd2_p2_bucket = new CallDescriptor(p1, 0, -1);
assertThat(cd2_p2_bucket, is(not(cd2_p2)));
// different policy with same id + different context id
CallDescriptor cd2_p2_context = new CallDescriptor(p1, -1, 0);
assertThat(cd2_p2_context, is(not(cd2_p2)));
// different policy with same id + different context & bucket id
CallDescriptor cd2_p2_ctx_buck = new CallDescriptor(p1, 0, 0);
assertThat(cd2_p2_ctx_buck, is(not(cd2_p2)));
}