CompletionUtils { public static String resolveStringDescription( String variableName, String defaultValue ) { String result = null; if( Constants.SPECIFIC_VARIABLE_IP.equalsIgnoreCase( variableName ) || variableName.toLowerCase().endsWith( "." + Constants.SPECIFIC_VARIABLE_IP )) result = SET_BY_ROBOCONF; else if( ! Utils.isEmptyOrWhitespaces( defaultValue )) result = DEFAULT_VALUE + defaultValue; 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 testResolveStringDescription() { Assert.assertEquals( SET_BY_ROBOCONF, resolveStringDescription( Constants.SPECIFIC_VARIABLE_IP, "" )); Assert.assertEquals( SET_BY_ROBOCONF, resolveStringDescription( "toto." + Constants.SPECIFIC_VARIABLE_IP, "" )); Assert.assertNull( resolveStringDescription( "", "" )); Assert.assertNull( resolveStringDescription( "", null )); Assert.assertEquals( DEFAULT_VALUE + "val", resolveStringDescription( "", "val" )); Assert.assertEquals( DEFAULT_VALUE + "val", CompletionUtils.resolveStringDescription( "toto" + Constants.SPECIFIC_VARIABLE_IP, "val" )); }