CleanSurefireExecution { protected static String sanitizeAndRemoveEnvironmentVars(String toSanitize) { String pattern = "\\$\\{([A-Za-z0-9\\.\\-]+)\\}"; Pattern expr = Pattern.compile(pattern); Matcher matcher = expr.matcher(toSanitize); while (matcher.find()) { Pattern subexpr = Pattern.compile(Pattern.quote(matcher.group(0))); toSanitize = subexpr.matcher(toSanitize).replaceAll(""); } return toSanitize.trim(); } protected  CleanSurefireExecution(Plugin surefire, String originalArgLine, String executionId,
            MavenProject mavenProject, MavenSession mavenSession, BuildPluginManager pluginManager,
            String nondexDir);  CleanSurefireExecution(Plugin surefire, String originalArgLine, MavenProject mavenProject,
            MavenSession mavenSession, BuildPluginManager pluginManager, String nondexDir); Configuration getConfiguration(); void run();  }
@Test public void testReplacementWorks() { String result = CleanSurefireExecution.sanitizeAndRemoveEnvironmentVars("${somestuff}"); assertEquals("", result); }
@Test public void testReplacementMultiple() { String result = CleanSurefireExecution.sanitizeAndRemoveEnvironmentVars("${some-stuff} ${some.MoreStuff} \n${a}"); assertEquals("", result); }
@Test public void testNothingChanges() { String result = CleanSurefireExecution.sanitizeAndRemoveEnvironmentVars("several$ }things{ in he}re"); assertEquals("several$ }things{ in he}re", result); }
@Test public void testMixed() { String result = CleanSurefireExecution.sanitizeAndRemoveEnvironmentVars("${somestuff} and other stuff ${and}}"); assertEquals("and other stuff }", result); }