ParameterUtilities { public String convertIndexedParametersToTemplateKeys( final String xlsTemplate, final ParameterizedValueBuilder.Part part ) { final StringBuffer result = new StringBuffer(); final Matcher matcherIndexedParameter = patternIndexedParameter.matcher( xlsTemplate ); while ( matcherIndexedParameter.find() ) { matcherIndexedParameter.appendReplacement( result, "@{" + PARAMETER_PREFIX + ( parameterCounter++ ) + "}" ); } matcherIndexedParameter.appendTail( result ); return assertTemplateKeyConversion( result, part ); }  String convertIndexedParametersToTemplateKeys( final String xlsTemplate,
                                                          final ParameterizedValueBuilder.Part part ); String convertSingleParameterToTemplateKey( final String xlsTemplate,
                                                       final ParameterizedValueBuilder.Part part ); Set<String> extractTemplateKeys( final String template );  }
@Test public void testIndexedParameters_LHSFieldValue() { final String result = utilities.convertIndexedParametersToTemplateKeys( "field1 == $1, field2 == $2", ParameterizedValueBuilder.Part.LHS ); assertEquals( "field1 == \"@{param1}\", field2 == \"@{param2}\"", result ); }
@Test public void testIndexedParameters_LHSFieldName() { final String result = utilities.convertIndexedParametersToTemplateKeys( "$1 != null, $2 != null", ParameterizedValueBuilder.Part.LHS ); assertEquals( "@{param1} != null, @{param2} != null", result ); }
@Test public void testIndexedParameters_RHSFieldValue() { final String result = utilities.convertIndexedParametersToTemplateKeys( "setField1( $1 ); setField2( $2 )", ParameterizedValueBuilder.Part.RHS ); assertEquals( "setField1( @{param1} ); setField2( @{param2} )", result ); }