### Question:
FileResolver { static List<Path> resolveExistingMigrations(File migrationsDir, boolean reversed, boolean onlySchemaMigrations) { if (!migrationsDir.exists()) { migrationsDir.mkdirs(); } File[] files = migrationsDir.listFiles(); if (files == null) { return Collections.emptyList(); } Comparator<Path> pathComparator = Comparator.comparingLong(FileResolver::compareVersionedMigrations); if (reversed) { pathComparator = pathComparator.reversed(); } return Arrays.stream(files) .map(File::toPath) .filter(path -> !onlySchemaMigrations || SCHEMA_FILENAME_PATTERN.matcher(path.getFileName().toString()).matches()) .sorted(pathComparator) .collect(Collectors.toList()); }    }### Answer:
@Test public void shouldReturnExistingMigrations() throws Exception { File migrationsDir = tempFolder.newFolder(); Path first = migrationsDir.toPath().resolve("v1__jpa2ddl_init.sql"); first.toFile().createNewFile(); Path second = migrationsDir.toPath().resolve("v2__my_description.sql"); second.toFile().createNewFile(); Path third = migrationsDir.toPath().resolve("v3__jpa2ddl.sql"); third.toFile().createNewFile(); List<Path> file = FileResolver.resolveExistingMigrations(migrationsDir, false, true); assertThat(file).containsSequence( first, third ); }