@Test
public void testGenerateSegments() throws Exception {

  List<BigInteger> tokens = Lists.transform(Lists.newArrayList(
          "0",
          "1",
          "56713727820156410577229101238628035242",
          "56713727820156410577229101238628035243",
          "113427455640312821154458202477256070484",
          "113427455640312821154458202477256070485"),
      (String string) -> new BigInteger(string));
  SegmentGenerator generator = new SegmentGenerator("foo.bar.RandomPartitioner");
  List<Segment> segments
      = generator.generateSegments(10, tokens, Boolean.FALSE, Maps.newHashMap(), "2.2.10");
  assertEquals(15, segments.size());
  assertEquals("(0,1]", segments.get(0).getBaseRange().toString());
  assertEquals(
      "(56713727820156410577229101238628035242,56713727820156410577229101238628035243]",
      segments.get(5).getBaseRange().toString());
  assertEquals(
      "(113427455640312821154458202477256070484,113427455640312821154458202477256070485]",
      segments.get(10).getBaseRange().toString());
  tokens = Lists.transform(Lists.newArrayList(
          "5",
          "6",
          "56713727820156410577229101238628035242",
          "56713727820156410577229101238628035243",
          "113427455640312821154458202477256070484",
          "113427455640312821154458202477256070485"),
      (String string) -> new BigInteger(string));
  segments = generator.generateSegments(10, tokens, Boolean.FALSE, Maps.newHashMap(), "2.2.10");
  assertEquals(15, segments.size());
  assertEquals("(5,6]", segments.get(0).getBaseRange().toString());
  assertEquals(
      "(56713727820156410577229101238628035242,56713727820156410577229101238628035243]",
      segments.get(5).getBaseRange().toString());
  assertEquals(
      "(113427455640312821154458202477256070484,113427455640312821154458202477256070485]",
      segments.get(10).getBaseRange().toString());
}