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 myTest3() {
    CloneIndex index = createIndex(
        newBlocks("b", "4 3 2"),
        newBlocks("c", "4 3 1")
        );
    Block[] fileBlocks = newBlocks("a", "1 2 3 4");
    List<CloneGroup> result = detect(index, fileBlocks);

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

    assertThat(result, hasCloneGroup(1,
        newClonePart("a", 0, 1),
        newClonePart("c", 2, 1)));

    assertThat(result, hasCloneGroup(1,
        newClonePart("a", 1, 1),
        newClonePart("b", 2, 1)));

    assertThat(result, hasCloneGroup(1,
        newClonePart("a", 2, 1),
        newClonePart("b", 1, 1),
        newClonePart("c", 1, 1)));

    assertThat(result, hasCloneGroup(1,
        newClonePart("a", 3, 1),
        newClonePart("b", 0, 1),
        newClonePart("c", 0, 1)));
  }