@Test public void applyDefaultValue() { Properties props = new Properties(); props.setProperty(PropertyParser.KEY_ENABLE_DEFAULT_VALUE, "true"); Assertions.assertThat(PropertyParser.parse("${key:default}", props)).isEqualTo("default"); Assertions.assertThat(PropertyParser.parse("SELECT * FROM ${tableName:users} ORDER BY ${orderColumn:id}", props)).isEqualTo("SELECT * FROM users ORDER BY id"); 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; }