Merge branch '7.0.x' into pmd7-language-lifecycle
This commit is contained in:
@ -113,8 +113,8 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -4,20 +4,18 @@
|
||||
|
||||
package net.sourceforge.pmd.cpd;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import net.sourceforge.pmd.cpd.test.CpdTextComparisonTest;
|
||||
import net.sourceforge.pmd.lang.ast.TokenMgrError;
|
||||
|
||||
public class ScalaTokenizerTest extends CpdTextComparisonTest {
|
||||
class ScalaTokenizerTest extends CpdTextComparisonTest {
|
||||
|
||||
@org.junit.Rule
|
||||
public ExpectedException ex = ExpectedException.none();
|
||||
|
||||
public ScalaTokenizerTest() {
|
||||
ScalaTokenizerTest() {
|
||||
super(".scala");
|
||||
}
|
||||
|
||||
@ -32,23 +30,22 @@ public class ScalaTokenizerTest extends CpdTextComparisonTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSample() {
|
||||
void testSample() {
|
||||
doTest("sample-LiftActor");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuppressionComments() {
|
||||
void testSuppressionComments() {
|
||||
doTest("special_comments");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tokenizeFailTest() {
|
||||
ex.expect(TokenMgrError.class);
|
||||
doTest("unlexable_sample");
|
||||
void tokenizeFailTest() {
|
||||
assertThrows(TokenMgrError.class, () -> doTest("unlexable_sample"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTabWidth() {
|
||||
void testTabWidth() {
|
||||
doTest("tabWidth");
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,11 @@
|
||||
|
||||
package net.sourceforge.pmd.lang.scala.rule;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import net.sourceforge.pmd.Report;
|
||||
import net.sourceforge.pmd.RuleContext;
|
||||
@ -17,12 +18,12 @@ import net.sourceforge.pmd.lang.scala.ast.ASTTermName;
|
||||
import net.sourceforge.pmd.lang.scala.ast.BaseScalaTest;
|
||||
import net.sourceforge.pmd.lang.scala.ast.ScalaNode;
|
||||
|
||||
public class ScalaRuleTest extends BaseScalaTest {
|
||||
class ScalaRuleTest extends BaseScalaTest {
|
||||
|
||||
private static final String SCALA_TEST = "/parserFiles/helloworld.scala";
|
||||
|
||||
@Test
|
||||
public void testRuleVisits() {
|
||||
void testRuleVisits() {
|
||||
final AtomicInteger visited = new AtomicInteger();
|
||||
ScalaRule rule = new ScalaRule() {
|
||||
|
||||
@ -34,11 +35,11 @@ public class ScalaRuleTest extends BaseScalaTest {
|
||||
};
|
||||
ASTSource root = scala.parseResource(SCALA_TEST);
|
||||
rule.apply(root, null);
|
||||
Assert.assertEquals(12, visited.get());
|
||||
assertEquals(12, visited.get());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDummyRule() {
|
||||
void testDummyRule() {
|
||||
ScalaRule rule = new ScalaRule() {
|
||||
@Override
|
||||
public String getMessage() {
|
||||
@ -56,6 +57,6 @@ public class ScalaRuleTest extends BaseScalaTest {
|
||||
};
|
||||
Report report = scala.executeRuleOnResource(rule, SCALA_TEST);
|
||||
|
||||
Assert.assertEquals(1, report.getViolations().size());
|
||||
assertEquals(1, report.getViolations().size());
|
||||
}
|
||||
}
|
||||
|
@ -4,21 +4,21 @@
|
||||
|
||||
package net.sourceforge.pmd.lang.scala.rule;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import net.sourceforge.pmd.Report;
|
||||
import net.sourceforge.pmd.RuleViolation;
|
||||
import net.sourceforge.pmd.lang.rule.XPathRule;
|
||||
import net.sourceforge.pmd.lang.scala.ast.BaseScalaTest;
|
||||
|
||||
public class XPathRuleTest extends BaseScalaTest {
|
||||
class XPathRuleTest extends BaseScalaTest {
|
||||
|
||||
private static final String SCALA_TEST = "/parserFiles/helloworld.scala";
|
||||
|
||||
@Test
|
||||
public void testPrintHelloWorld() {
|
||||
void testPrintHelloWorld() {
|
||||
Report report = evaluate(SCALA_TEST, "//TermApply/TermName[@Image=\"println\"]");
|
||||
RuleViolation rv = report.getViolations().get(0);
|
||||
assertEquals(2, rv.getBeginLine());
|
||||
|
@ -7,7 +7,7 @@ package net.sourceforge.pmd.lang.scala.ast
|
||||
import net.sourceforge.pmd.lang.ast.test.BaseParsingHelper
|
||||
import net.sourceforge.pmd.lang.ast.test.BaseTreeDumpTest
|
||||
import net.sourceforge.pmd.lang.ast.test.SimpleNodePrinter
|
||||
import org.junit.Test
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class ScalaParserTests : BaseTreeDumpTest(SimpleNodePrinter, ".scala") {
|
||||
|
||||
|
@ -6,9 +6,6 @@ package net.sourceforge.pmd.lang.scala.ast
|
||||
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.should
|
||||
import net.sourceforge.pmd.lang.LanguageRegistry
|
||||
import net.sourceforge.pmd.lang.ast.Node
|
||||
import net.sourceforge.pmd.lang.ast.test.assertBounds
|
||||
import net.sourceforge.pmd.lang.ast.test.matchNode
|
||||
import net.sourceforge.pmd.lang.ast.test.assertPosition
|
||||
import net.sourceforge.pmd.lang.ast.test.shouldBe
|
||||
|
Reference in New Issue
Block a user