### Question:
Converters { public static Function<String,File[]> regexFiles( final boolean cleverNumberRegexSort ) { return name -> { Comparator<File> sorting = cleverNumberRegexSort ? BY_FILE_NAME_WITH_CLEVER_NUMBERS : BY_FILE_NAME; List<File> files = Validators.matchingFiles( new File( name.trim() ) ); files.sort( sorting ); return files.toArray( new File[files.size()] ); }; } private  Converters(); static Function<String,T> mandatory(); static Function<String,T> optional(); static Function<String,T> withDefault( final T defaultValue ); static Function<String,File> toFile(); static Function<String, Path> toPath(); static Function<String, String> identity(); static Function<String,File[]> regexFiles( final boolean cleverNumberRegexSort ); static Function<String,File[]> toFiles( final String delimiter,
            final Function<String,File[]> eachFileConverter ); static Function<String,Integer> toInt(); static OptionalHostnamePort toOptionalHostnamePortFromRawAddress( String rawAddress ); static final Comparator<File> BY_FILE_NAME; static final Comparator<File> BY_FILE_NAME_WITH_CLEVER_NUMBERS; }### Answer:
@Test public void shouldSortFilesByNumberCleverly() throws Exception { File file1 = existenceOfFile( "file1" ); File file123 = existenceOfFile( "file123" ); File file12 = existenceOfFile( "file12" ); File file2 = existenceOfFile( "file2" ); File file32 = existenceOfFile( "file32" ); File[] files = regexFiles( true ).apply( directory.file( "file.*" ).getAbsolutePath() ); assertArrayEquals( new File[]{file1, file2, file12, file32, file123}, files ); }