Merge branch '7.0.x' into pmd7-language-lifecycle

This commit is contained in:
Clément Fournier
2023-02-02 01:00:11 +01:00
121 changed files with 1804 additions and 1978 deletions

View File

@ -290,21 +290,11 @@
<artifactId>junit-platform-suite</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.stefanbirkner</groupId>
<artifactId>system-rules</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.stefanbirkner</groupId>
<artifactId>system-lambda</artifactId>

View File

@ -191,7 +191,7 @@ class CpdCliTest extends BaseCliTest {
* See: https://sourceforge.net/p/pmd/bugs/1178/
*/
@Test
public void testSkipLexicalErrors() throws Exception {
void testSkipLexicalErrors() throws Exception {
runCli(VIOLATIONS_FOUND,
"--minimum-tokens", "10",
"-d", BASE_RES_PATH + "badandgood/",
@ -205,21 +205,21 @@ class CpdCliTest extends BaseCliTest {
@Test
public void jsShouldFindDuplicatesWithDifferentFileExtensions() throws Exception {
void jsShouldFindDuplicatesWithDifferentFileExtensions() throws Exception {
runCli(VIOLATIONS_FOUND, "--minimum-tokens", "5", "--language", "js",
"-d", BASE_RES_PATH + "tsFiles/File1.ts", BASE_RES_PATH + "tsFiles/File2.ts")
.checkStdOut(containsString("Found a 9 line (32 tokens) duplication in the following files"));
}
@Test
public void jsShouldFindNoDuplicatesWithDifferentFileExtensions() throws Exception {
void jsShouldFindNoDuplicatesWithDifferentFileExtensions() throws Exception {
runCli(OK, "--minimum-tokens", "5", "--language", "js",
"-d", BASE_RES_PATH + "tsFiles/")
.checkStdOut(emptyString());
}
@Test
public void renderEmptyReportXml() throws Exception {
void renderEmptyReportXml() throws Exception {
runCli(OK, "--minimum-tokens", "5", "--language", "js",
"-f", "xml",
"-d", BASE_RES_PATH + "tsFiles/")

View File

@ -13,7 +13,7 @@ import java.util.List;
import org.junit.jupiter.api.Test;
public class ForceLanguageCliTest extends BaseCliTest {
class ForceLanguageCliTest extends BaseCliTest {
private static final String BASE_DIR = "src/test/resources/net/sourceforge/pmd/cli/forceLanguage/";
private static final String RULE_MESSAGE = "Violation from ReportAllRootNodes";
@ -29,19 +29,19 @@ public class ForceLanguageCliTest extends BaseCliTest {
}
@Test
public void analyzeSingleXmlWithoutForceLanguage() throws Exception {
void analyzeSingleXmlWithoutForceLanguage() throws Exception {
runCli(OK, "-d", BASE_DIR + "src/file1.ext")
.verify(r -> r.checkStdOut(containsStringNTimes(0, RULE_MESSAGE)));
}
@Test
public void analyzeSingleXmlWithForceLanguage() throws Exception {
void analyzeSingleXmlWithForceLanguage() throws Exception {
runCli(VIOLATIONS_FOUND, "-d", BASE_DIR + "src/file1.ext", "--force-language", "dummy")
.verify(r -> r.checkStdOut(containsStringNTimes(1, RULE_MESSAGE)));
}
@Test
public void analyzeDirectoryWithForceLanguage() throws Exception {
void analyzeDirectoryWithForceLanguage() throws Exception {
runCli(VIOLATIONS_FOUND, "-d", BASE_DIR + "src/", "--force-language", "dummy")
.verify(r -> r.checkStdOut(containsStringNTimes(3, RULE_MESSAGE)));
}