CompletionUtils { static Set<String> findFilesToImport( File searchDirectory, String fileExtension, File editedFile, String fileContent ) { Set<String> result = new TreeSet<> (); if( searchDirectory.exists()) { for( File f : Utils.listAllFiles( searchDirectory, fileExtension )) { if( f.equals( editedFile )) continue; String path = Utils.computeFileRelativeLocation( searchDirectory, f ); result.add( path ); } } Pattern importPattern = Pattern.compile( "\\b" + ParsingConstants.KEYWORD_IMPORT + "\\s+(.*)", Pattern.CASE_INSENSITIVE ); Matcher m = importPattern.matcher( fileContent ); while( m.find()) { String imp = m.group( 1 ).trim(); if( imp.endsWith( ";" )) imp = imp.substring( 0, imp.length() - 1 ); result.remove( imp.trim()); } return result; } private  CompletionUtils(); static Set<String> findGraphFilesToImport( File appDirectory, File editedFile, String fileContent ); static Set<String> findInstancesFilesToImport( File appDirectory, File editedFile, String fileContent ); static RoboconfCompletionProposal basicProposal( String s, String lastWord, boolean trim ); static RoboconfCompletionProposal basicProposal( String s, String lastWord ); static boolean startsWith( String s, String prefix ); static Map<String,RoboconfTypeBean> findAllTypes( File appDirectory ); static String resolveStringDescription( String variableName, String defaultValue ); static Map<String,String> findAllExportedVariables( File appDirectory ); static Map<String,String> findTypeNames( File appDirectory, boolean includeFacets, boolean includeComponents ); static List<RoboconfCompletionProposal> buildProposalsFromMap( Map<String,String> candidates, String prefix ); static final String DEFAULT_VALUE; static final String SET_BY_ROBOCONF; static final String IMPORT_ALL_THE_VARIABLES; }
@Test public void testFindFilesToImport_inexistingSearchDirectory() { Assert.assertEquals( 0, findFilesToImport( new File( "whatever" ), null, null, "" ).size()); }