@Test public void testParseExportedVariable() { String[][] values = { { "variableName", "" }, { "variableName", "default value" }, { "complex.variable.name", "51" }, { "", "oops" } }; for( String[] value : values ) { String s = value[ 0 ] + " = " + value[ 1 ]; Map.Entry<String,String> entry = VariableHelpers.parseExportedVariable( s ); Assert.assertEquals( "Invalid variable name for " + s, value[ 0 ], entry.getKey()); Assert.assertEquals( "Invalid default value for " + s, value[ 1 ], entry.getValue()); } }
public static Map.Entry<String,String> parseExportedVariable( String exportedVariable ) { int index = exportedVariable.indexOf( '=' ); String varName = exportedVariable, defaultValue = null; if( index > 0 ) { varName = exportedVariable.substring( 0, index ).trim(); defaultValue = exportedVariable.substring( index + 1 ).trim(); } return new AbstractMap.SimpleEntry<>( varName, defaultValue ); }
VariableHelpers { public static Map.Entry<String,String> parseExportedVariable( String exportedVariable ) { int index = exportedVariable.indexOf( '=' ); String varName = exportedVariable, defaultValue = null; if( index > 0 ) { varName = exportedVariable.substring( 0, index ).trim(); defaultValue = exportedVariable.substring( index + 1 ).trim(); } return new AbstractMap.SimpleEntry<>( varName, defaultValue ); } }
VariableHelpers { public static Map.Entry<String,String> parseExportedVariable( String exportedVariable ) { int index = exportedVariable.indexOf( '=' ); String varName = exportedVariable, defaultValue = null; if( index > 0 ) { varName = exportedVariable.substring( 0, index ).trim(); defaultValue = exportedVariable.substring( index + 1 ).trim(); } return new AbstractMap.SimpleEntry<>( varName, defaultValue ); } private  VariableHelpers(); }
VariableHelpers { public static Map.Entry<String,String> parseExportedVariable( String exportedVariable ) { int index = exportedVariable.indexOf( '=' ); String varName = exportedVariable, defaultValue = null; if( index > 0 ) { varName = exportedVariable.substring( 0, index ).trim(); defaultValue = exportedVariable.substring( index + 1 ).trim(); } return new AbstractMap.SimpleEntry<>( varName, defaultValue ); } private  VariableHelpers(); static Map.Entry<String,String> parseVariableName( String variableName ); static Map.Entry<String,String> parseExportedVariable( String exportedVariable ); static Map<String,ExportedVariable> parseExportedVariables( String line ); static Set<String> findPrefixesForExportedVariables( Instance instance ); static Set<String> findPrefixesForImportedVariables( Instance instance ); static Set<String> findPrefixesForMandatoryImportedVariables( Instance instance ); static Set<String> findPrefixesForExternalImports( AbstractApplication app ); }
VariableHelpers { public static Map.Entry<String,String> parseExportedVariable( String exportedVariable ) { int index = exportedVariable.indexOf( '=' ); String varName = exportedVariable, defaultValue = null; if( index > 0 ) { varName = exportedVariable.substring( 0, index ).trim(); defaultValue = exportedVariable.substring( index + 1 ).trim(); } return new AbstractMap.SimpleEntry<>( varName, defaultValue ); } private  VariableHelpers(); static Map.Entry<String,String> parseVariableName( String variableName ); static Map.Entry<String,String> parseExportedVariable( String exportedVariable ); static Map<String,ExportedVariable> parseExportedVariables( String line ); static Set<String> findPrefixesForExportedVariables( Instance instance ); static Set<String> findPrefixesForImportedVariables( Instance instance ); static Set<String> findPrefixesForMandatoryImportedVariables( Instance instance ); static Set<String> findPrefixesForExternalImports( AbstractApplication app );  }