@Test
  public void testMaxFileSelection() throws MergeException, IOException {
    int oldMaxCrossCompactionCandidateFileNum =
        IoTDBDescriptor.getInstance().getConfig().getFileLimitPerCrossTask();
    IoTDBDescriptor.getInstance().getConfig().setFileLimitPerCrossTask(5);
    RewriteCrossSpaceCompactionSelector selector =
        new RewriteCrossSpaceCompactionSelector("", "", 0, null, new CompactionScheduleContext());
    List<CrossCompactionTaskResource> selected =
        selector.selectCrossSpaceTask(seqResources, unseqResources);
    assertEquals(1, selected.size());
    List<TsFileResource> seqSelected = selected.get(0).getSeqFiles();
    List<TsFileResource> unseqSelected = selected.get(0).getUnseqFiles();
    assertEquals(2, seqSelected.size());
    assertEquals(2, unseqSelected.size());

    IoTDBDescriptor.getInstance()
        .getConfig()
        .setFileLimitPerCrossTask(oldMaxCrossCompactionCandidateFileNum);
  }
5 source seq files: [11,11] [12,12] [13,13] [14,14] [15,15]<br>
4 source unseq files: [7~9] [10~13] [14~16] [17~18]<br>
while the forth seq file is not close.<br>
selected seq file index: 1 2 3 <br>
selected unseq file index: 1 2
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/cross/RewriteCompactionFileSelectorTest.java