@Test public void applyCustomSeparator() { Properties props = new Properties(); props.setProperty(PropertyParser.KEY_ENABLE_DEFAULT_VALUE, "true"); props.setProperty(PropertyParser.KEY_DEFAULT_VALUE_SEPARATOR, "?:"); Assertions.assertThat(PropertyParser.parse("${key?:default}", props)).isEqualTo("default"); Assertions.assertThat(PropertyParser.parse("SELECT * FROM ${schema?:prod}.${tableName == null ? 'users' : tableName} ORDER BY ${orderColumn}", props)).isEqualTo("SELECT * FROM prod.${tableName == null ? 'users' : tableName} ORDER BY ${orderColumn}"); Assertions.assertThat(PropertyParser.parse("${key?:}", props)).isEmpty(); Assertions.assertThat(PropertyParser.parse("${key?: }", props)).isEqualTo(" "); Assertions.assertThat(PropertyParser.parse("${key?::}", props)).isEqualTo(":"); }
public static String parse(String string, Properties variables) { VariableTokenHandler handler = new VariableTokenHandler(variables); GenericTokenParser parser = new GenericTokenParser("${", "}", handler); return parser.parse(string); }
PropertyParser { public static String parse(String string, Properties variables) { VariableTokenHandler handler = new VariableTokenHandler(variables); GenericTokenParser parser = new GenericTokenParser("${", "}", handler); return parser.parse(string); } }
PropertyParser { public static String parse(String string, Properties variables) { VariableTokenHandler handler = new VariableTokenHandler(variables); GenericTokenParser parser = new GenericTokenParser("${", "}", handler); return parser.parse(string); } private  PropertyParser(); }
PropertyParser { public static String parse(String string, Properties variables) { VariableTokenHandler handler = new VariableTokenHandler(variables); GenericTokenParser parser = new GenericTokenParser("${", "}", handler); return parser.parse(string); } private  PropertyParser(); static String parse(String string, Properties variables); }
PropertyParser { public static String parse(String string, Properties variables) { VariableTokenHandler handler = new VariableTokenHandler(variables); GenericTokenParser parser = new GenericTokenParser("${", "}", handler); return parser.parse(string); } private  PropertyParser(); static String parse(String string, Properties variables); static final String KEY_ENABLE_DEFAULT_VALUE; static final String KEY_DEFAULT_VALUE_SEPARATOR; }