WorkflowConditionInterpreter { static String replaceDefaults(String source) { final Matcher matcher = PROPERTY_PATTERN.matcher(source); final StringBuilder result = new StringBuilder(); int cursor = 0; boolean matchFound = matcher.find(); if (!matchFound) { return source; } while (matchFound) { int matchStart = matcher.start(); int matchEnd = matcher.end(); result.append(source, cursor, matchStart); String defaultValue = matcher.group("def"); if (defaultValue == null) { defaultValue = "false"; } result.append(defaultValue); cursor = matchEnd; matchFound = matcher.find(); if (!matchFound) result.append(source.substring(matchEnd)); } return result.toString(); } private  WorkflowConditionInterpreter(); static String replaceVariables(String source, Function<String, String> systemPropertyGetter,
          Map<String, String> properties, boolean quoteStrings); static boolean interpret(final String input);  }
@Test public void replaceDefaultWithoutDefaultValue() { assertEquals("before false after", WorkflowConditionInterpreter.replaceDefaults("before ${foo} after")); }
@Test public void replaceDefaultWithDefaultValue() { assertEquals("before 1 after", WorkflowConditionInterpreter.replaceDefaults("before ${foo:1} after")); }