assertEquals(true, rejected);
assertEquals(true, accepted);
}
public void testEquals() {
ConnectionFilter cf1, cf2, cf3;
Range range = new Range(rand.nextInt(10000), rand.nextInt(10000) + 100);
// Test SourcePartionConnectionFilter
cf1 = new SourcePartitionConnectionFilter(range);
cf2 = null;
assertFalse(cf1.equals(cf2));
cf2 = new SourcePartitionConnectionFilter(range);
assertTrue(cf1.equals(cf2));
assertTrue(cf2.equals(cf1));
assertTrue(cf1.equals(cf1));
assertTrue(cf2.equals(cf2));
assertEquals(cf1.hashCode(), cf2.hashCode());
// Test TargetPartionConnectionFilter
cf1 = new TargetPartitionConnectionFilter(range);
cf2 = null;
assertFalse(cf1.equals(cf2));
cf2 = new TargetPartitionConnectionFilter(range);
assertTrue(cf1.equals(cf2));
assertTrue(cf2.equals(cf1));
assertTrue(cf1.equals(cf1));
assertTrue(cf2.equals(cf2));
assertEquals(cf1.hashCode(), cf2.hashCode());
// Test TransitivePartionConnectionFilter
cf1 = new TransitivePartitionConnectionFilter(range);
cf2 = null;
assertFalse(cf1.equals(cf2));
cf2 = new TransitivePartitionConnectionFilter(range);
assertTrue(cf1.equals(cf2));
assertTrue(cf2.equals(cf1));
assertTrue(cf1.equals(cf1));
assertTrue(cf2.equals(cf2));
assertEquals(cf1.hashCode(), cf2.hashCode());
// Test cross comparison
cf1 = new SourcePartitionConnectionFilter(range);
cf2 = new TargetPartitionConnectionFilter(range);
cf3 = new TransitivePartitionConnectionFilter(range);
assertFalse(cf1.equals(cf2));
assertFalse(cf1.equals(cf3));
assertFalse(cf2.equals(cf1));
assertFalse(cf2.equals(cf3));
assertFalse(cf3.equals(cf1));
assertFalse(cf3.equals(cf2));
}