private final Random rand = new Random();
public void testSourcePartitionConnectionFilter() {
int start = rand.nextInt(10000) + 100;
int count = rand.nextInt(10000) + 100;
Range sourceRange = new Range(start, count);
ConnectionFilter connFilter = new SourcePartitionConnectionFilter(sourceRange);
Connection conn = new SimpleConnection(0, rand.nextInt(), true);
assertEquals(false, connFilter.accept(conn));
conn = new SimpleConnection(rand.nextInt(start), rand.nextInt(), true);
assertEquals(false, connFilter.accept(conn));
conn = new SimpleConnection(start + rand.nextInt(count), rand.nextInt(), true);
assertEquals(true, connFilter.accept(conn));
conn = new SimpleConnection(sourceRange.getEnd(), rand.nextInt(), true);
assertEquals(false, connFilter.accept(conn));
conn = new SimpleConnection(sourceRange.getEnd() + rand.nextInt(count), rand.nextInt(), true);
assertEquals(false, connFilter.accept(conn));
}