TestDataGroupVirtualFile (@NotNull TestDataFile testDataFile1, @NotNull TestDataFile testDataFile2) { VirtualFile file1 = testDataFile1.getVirtualFile(); VirtualFile file2 = testDataFile2.getVirtualFile(); if (file1 == null || file2 == null) { return null; } if (!Objects.equals(file1.getParent(), file2.getParent())) { return null; } @NonNls String file1Name = file1.getName(); @NonNls String file2Name = file2.getName(); int commonPrefixLength = StringUtil.commonPrefixLength(file1Name, file2Name); if (commonPrefixLength == 0) { if (isBeforeAfterPrefixedPair(file1Name, file2Name)) { return new TestDataGroupVirtualFile(file1, file2); } if (isBeforeAfterPrefixedPair(file2Name, file1Name)) { return new TestDataGroupVirtualFile(file2, file1); } } if (isAfterSuffixed(file1Name, file2Name, commonPrefixLength)) { return new TestDataGroupVirtualFile(file2, file1); } if (isAfterSuffixed(file2Name, file1Name, commonPrefixLength)) { return new TestDataGroupVirtualFile(file1, file2); } return null; }