* @throws Exception If failed.
*/
public void testRangeSplit() throws Exception {
GridUuid affKey = GridUuid.randomUuid();
GridGgfsFileAffinityRange range = new GridGgfsFileAffinityRange(0, 9999, affKey);
Collection<GridGgfsFileAffinityRange> split = range.split(10000);
assertEquals(1, split.size());
assertTrue(range.regionEqual(F.first(split)));
split = range.split(5000);
assertEquals(2, split.size());
Iterator<GridGgfsFileAffinityRange> it = split.iterator();
GridGgfsFileAffinityRange part = it.next();
assertTrue(part.regionEqual(new GridGgfsFileAffinityRange(0, 4999, affKey)));
part = it.next();
assertTrue(part.regionEqual(new GridGgfsFileAffinityRange(5000, 9999, affKey)));
split = range.split(3000);
assertEquals(4, split.size());
it = split.iterator();
part = it.next();
assertTrue(part.regionEqual(new GridGgfsFileAffinityRange(0, 2999, affKey)));
part = it.next();
assertTrue(part.regionEqual(new GridGgfsFileAffinityRange(3000, 5999, affKey)));
part = it.next();
assertTrue(part.regionEqual(new GridGgfsFileAffinityRange(6000, 8999, affKey)));
part = it.next();
assertTrue(part.regionEqual(new GridGgfsFileAffinityRange(9000, 9999, affKey)));
}