public static List<CloneGroup> detect(CloneIndex cloneIndex, Collection<Block> fileBlocks) {
    if (fileBlocks.isEmpty()) {
      return Collections.emptyList();
    }
    TextSet text = createTextSet(cloneIndex, fileBlocks);
    if (text == null) {
      return Collections.emptyList();
    }
    DuplicationsCollector reporter = new DuplicationsCollector(text);
    Search.perform(text, reporter);
    return reporter.getResult();
  }
@Test
  public void myTest() {
    CloneIndex index = createIndex();
    Block[] fileBlocks = newBlocks("x", "a 2 b 2 c 2 2 2");
    List<CloneGroup> result = detect(index, fileBlocks);

    print(result);
    assertEquals(2, result.size());

    assertThat(result, hasCloneGroup(2,
        newClonePart("x", 5, 2),
        newClonePart("x", 6, 2)));

    assertThat(result, hasCloneGroup(1,
        newClonePart("x", 1, 1),
        newClonePart("x", 3, 1),
        newClonePart("x", 5, 1),
        newClonePart("x", 6, 1),
        newClonePart("x", 7, 1)));
  }