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 huge() {
    CloneIndex index = createIndex();
    Block[] fileBlocks = new Block[5000];
    for (int i = 0; i < 5000; i++) {
      fileBlocks[i] = newBlock("x", new ByteArray("01"), i);
    }
    List<CloneGroup> result = detect(index, fileBlocks);

    assertEquals(1, result.size());
  }