### Question:
ArchiveMerger { List<FileEntry> sort(List<FileEntry> archiveParts) { return archiveParts.stream() .sorted(Comparator.comparingInt(this::getArchivePartIndex)) .collect(Collectors.toList()); } ArchiveMerger(FileService fileService, StepLogger stepLogger, DelegateExecution execution); Path createArchiveFromParts(List<FileEntry> archiveParts);  }### Answer:
@Test void testSortFileEntries() { List<FileEntry> randomSortedFileEntries = createFileEntriesFromFile(RANDOM_SORTED_ENTRIES); List<FileEntry> expectedFileEntries = createFileEntriesFromFile(EXPECTED_FILE_ENTRIES); List<FileEntry> sortedFileEntries = archiveMerger.sort(randomSortedFileEntries); Assertions.assertIterableEquals(getFileEntriesNames(expectedFileEntries), getFileEntriesNames(sortedFileEntries)); }
@Test void testSortFileEntriesWithInvalidNames() { List<FileEntry> invalidFileEntries = createFileEntriesFromFile(FILE_ENTRIES_WITH_INVALID_NAMES); Assertions.assertThrows(SLException.class, () -> archiveMerger.sort(invalidFileEntries)); }
@Test void testSortFileEntriesWithNamesWhichContainPartButDoNotContainIndexes() { List<FileEntry> invalidFileEntries = createFileEntriesFromFile(FILE_ENTRIES_WITHOUT_INDEXES); Assertions.assertThrows(SLException.class, () -> archiveMerger.sort(invalidFileEntries)); }