Disable progress bar in some tests

This commit is contained in:
Clément Fournier
2022-07-22 17:39:15 +02:00
parent 44d59fd4e3
commit 29d31ec8d2
3 changed files with 9 additions and 7 deletions

View File

@@ -21,6 +21,8 @@ import net.sourceforge.pmd.internal.Slf4jSimpleConfiguration;
* @author Romain Pelisse <belaran@gmail.com>
*/
public class CLITest extends BaseCLITest {
// note that the progress bar sometimes messes up the log so it is
// disabled here in most tests.
// restoring system properties: -debug might change logging properties
// See Slf4jSimpleConfigurationForAnt and resetLogging
@@ -63,7 +65,7 @@ public class CLITest extends BaseCLITest {
@Test
public void changeJavaVersion() {
String[] args = { "-d", SOURCE_FOLDER, "-f", "text", "-R", RSET_NO_VIOLATION, "-version", "1.5", "-language", "java", "--debug" };
String[] args = { "-d", SOURCE_FOLDER, "-f", "text", "-R", RSET_NO_VIOLATION, "-version", "1.5", "-language", "java", "--debug", "--no-progress", };
String log = runTest(args);
assertThat(log, containsPattern("Adding file .*\\.java \\(lang: java 1\\.5\\)"));
}
@@ -75,21 +77,21 @@ public class CLITest extends BaseCLITest {
@Test
public void exitStatusWithViolations() {
String[] args = { "-d", SOURCE_FOLDER, "-f", "text", "-R", RSET_WITH_VIOLATION, };
String[] args = { "-d", SOURCE_FOLDER, "-f", "text", "-R", RSET_WITH_VIOLATION, "--no-progress", };
String log = runTest(StatusCode.VIOLATIONS_FOUND, args);
assertThat(log, containsString("Violation from test-rset-1.xml"));
}
@Test
public void exitStatusWithViolationsAndWithoutFailOnViolations() {
String[] args = { "-d", SOURCE_FOLDER, "-f", "text", "-R", RSET_WITH_VIOLATION, "-failOnViolation", "false", };
String[] args = { "-d", SOURCE_FOLDER, "-f", "text", "-R", RSET_WITH_VIOLATION, "-failOnViolation", "false", "--no-progress", };
String log = runTest(StatusCode.OK, args);
assertThat(log, containsString("Violation from test-rset-1.xml"));
}
@Test
public void exitStatusWithViolationsAndWithoutFailOnViolationsLongOption() {
String[] args = { "-d", SOURCE_FOLDER, "-f", "text", "-R", RSET_WITH_VIOLATION, "--fail-on-violation", "false", };
String[] args = { "-d", SOURCE_FOLDER, "-f", "text", "-R", RSET_WITH_VIOLATION, "--fail-on-violation", "false", "--no-progress", };
String log = runTest(StatusCode.OK, args);
assertThat(log, containsString("Violation from test-rset-1.xml"));
}

View File

@@ -24,8 +24,7 @@ public class CLITest extends BaseCLITest {
"xml",
"-R",
"rulesets/testing/js-rset1.xml",
"-l",
"ecmascript",
"--no-progress",
"--debug");
assertThat(log, containsPattern("Adding file .*\\.js \\(lang: ecmascript ES6\\)"));
}

View File

@@ -25,7 +25,8 @@ public class XmlCliTest extends BaseCLITest {
List<String> arguments = new ArrayList<>(listOf(
"-f",
"text",
"-no-cache",
"--no-cache",
"--no-progress",
"-R",
BASE_DIR + "/ruleset.xml",
"-d",