diff --git a/pom.xml b/pom.xml
index 0685f3d..3ed7eab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -42,6 +42,8 @@
7.15.0
3.5.3
5.13.3
+ 3.6.0
+ 10.26.1
10800
@@ -198,6 +200,35 @@
central-publishing-maven-plugin
0.8.0
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+ ${checkstyle.plugin.version}
+
+
+ checkstyle-check
+ verify
+
+ check
+
+
+
+
+
+ com.puppycrawl.tools
+ checkstyle
+ ${checkstyle.version}
+
+
+
+ ${project.basedir}/src/main/resources/net/sourceforge/pmd/pmd-checkstyle-config.xml
+ ${project.basedir}/src/main/resources/net/sourceforge/pmd/pmd-checkstyle-suppressions.xml
+ true
+ true
+ **/*.java,**/*.kt
+ **/*.properties,**/*.less
+
+
@@ -271,6 +302,11 @@
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+
+
org.sonatype.central
central-publishing-maven-plugin
diff --git a/src/main/java/net/sourceforge/pmd/buildtools/surefire/AccumulatingConsoleReporter.java b/src/main/java/net/sourceforge/pmd/buildtools/surefire/AccumulatingConsoleReporter.java
index 837b313..d43335b 100644
--- a/src/main/java/net/sourceforge/pmd/buildtools/surefire/AccumulatingConsoleReporter.java
+++ b/src/main/java/net/sourceforge/pmd/buildtools/surefire/AccumulatingConsoleReporter.java
@@ -28,7 +28,7 @@ class AccumulatingConsoleReporter extends StatelessTestsetInfoConsoleReportEvent
private final boolean showSkippedTests;
- public AccumulatingConsoleReporter(ConsoleLogger logger, boolean showSuccessfulTests, boolean showFailedTests, boolean showSkippedTests) {
+ AccumulatingConsoleReporter(ConsoleLogger logger, boolean showSuccessfulTests, boolean showFailedTests, boolean showSkippedTests) {
super(logger);
this.showSuccessfulTests = showSuccessfulTests;
this.showFailedTests = showFailedTests;
@@ -213,18 +213,20 @@ private static String getTestCaseName(WrappedReportEntry entry, String testSetNa
private static void accumulateTestSetStats(TestSetStats accumulated, Collection reportEntries) {
for (WrappedReportEntry entry : reportEntries) {
switch (entry.getReportEntryType()) {
- case SUCCESS:
- accumulated.testSucceeded(entry);
- break;
- case SKIPPED:
- accumulated.testSkipped(entry);
- break;
- case FAILURE:
- accumulated.testFailure(entry);
- break;
- case ERROR:
- accumulated.testError(entry);
- break;
+ case SUCCESS:
+ accumulated.testSucceeded(entry);
+ break;
+ case SKIPPED:
+ accumulated.testSkipped(entry);
+ break;
+ case FAILURE:
+ accumulated.testFailure(entry);
+ break;
+ case ERROR:
+ accumulated.testError(entry);
+ break;
+ default:
+ throw new IllegalStateException("Unknown report entry type: " + entry.getReportEntryType());
}
}
}
diff --git a/src/main/java/net/sourceforge/pmd/buildtools/surefire/junit/JUnitPlatformProvider.java b/src/main/java/net/sourceforge/pmd/buildtools/surefire/junit/JUnitPlatformProvider.java
index 9de5a39..f57ab22 100644
--- a/src/main/java/net/sourceforge/pmd/buildtools/surefire/junit/JUnitPlatformProvider.java
+++ b/src/main/java/net/sourceforge/pmd/buildtools/surefire/junit/JUnitPlatformProvider.java
@@ -1,3 +1,7 @@
+/*
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+
package net.sourceforge.pmd.buildtools.surefire.junit;
import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass;
diff --git a/src/main/java/net/sourceforge/pmd/buildtools/surefire/junit/RootContainer.java b/src/main/java/net/sourceforge/pmd/buildtools/surefire/junit/RootContainer.java
index 52d67fc..dd49f66 100644
--- a/src/main/java/net/sourceforge/pmd/buildtools/surefire/junit/RootContainer.java
+++ b/src/main/java/net/sourceforge/pmd/buildtools/surefire/junit/RootContainer.java
@@ -1,3 +1,7 @@
+/*
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+
package net.sourceforge.pmd.buildtools.surefire.junit;
import org.junit.platform.engine.UniqueId;
@@ -7,7 +11,7 @@ class RootContainer {
private final TestIdentifier testIdentifier;
private boolean hasTests = false;
- public RootContainer(TestIdentifier testIdentifier) {
+ RootContainer(TestIdentifier testIdentifier) {
this.testIdentifier = testIdentifier;
}
diff --git a/src/main/java/net/sourceforge/pmd/buildtools/surefire/junit/TestExecutionListener.java b/src/main/java/net/sourceforge/pmd/buildtools/surefire/junit/TestExecutionListener.java
index 6c3ddb3..1c2d88b 100644
--- a/src/main/java/net/sourceforge/pmd/buildtools/surefire/junit/TestExecutionListener.java
+++ b/src/main/java/net/sourceforge/pmd/buildtools/surefire/junit/TestExecutionListener.java
@@ -1,3 +1,7 @@
+/*
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+
package net.sourceforge.pmd.buildtools.surefire.junit;
import java.lang.management.ManagementFactory;
@@ -30,7 +34,7 @@ class TestExecutionListener implements org.junit.platform.launcher.TestExecution
private final TestReportListener testReportListener;
- public TestExecutionListener(TestReportListener testReportListener) {
+ TestExecutionListener(TestReportListener testReportListener) {
this.testReportListener = testReportListener;
}
@@ -90,19 +94,21 @@ public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult
determineRootContainer(testIdentifier).ifPresent(RootContainer::markHasAtLeastOneTest);
switch (testExecutionResult.getStatus()) {
- case SUCCESSFUL:
- testReportListener.testSucceeded(reportEntry);
- break;
- case FAILED:
- if (isAssertionError) {
- testReportListener.testFailed(reportEntry);
- } else {
- testReportListener.testError(reportEntry);
- }
- break;
- case ABORTED:
- testReportListener.testAssumptionFailure(reportEntry);
- break;
+ case SUCCESSFUL:
+ testReportListener.testSucceeded(reportEntry);
+ break;
+ case FAILED:
+ if (isAssertionError) {
+ testReportListener.testFailed(reportEntry);
+ } else {
+ testReportListener.testError(reportEntry);
+ }
+ break;
+ case ABORTED:
+ testReportListener.testAssumptionFailure(reportEntry);
+ break;
+ default:
+ throw new IllegalStateException("Unknown execution result status: " + testExecutionResult.getStatus());
}
}
}
diff --git a/src/test/java/net/sourceforge/pmd/buildtools/surefire/AccumulatingConsoleReporterTest.java b/src/test/java/net/sourceforge/pmd/buildtools/surefire/AccumulatingConsoleReporterTest.java
index d7d5331..13024e8 100644
--- a/src/test/java/net/sourceforge/pmd/buildtools/surefire/AccumulatingConsoleReporterTest.java
+++ b/src/test/java/net/sourceforge/pmd/buildtools/surefire/AccumulatingConsoleReporterTest.java
@@ -25,6 +25,7 @@ public class AccumulatingConsoleReporterTest {
private MockedConsoleLogger logger;
private AccumulatingConsoleReporter reporter;
+
@BeforeEach
void setup() {
logger = new MockedConsoleLogger();
@@ -172,13 +173,13 @@ void junitSuiteReport() {
reporter.testSetCompleted(testSuiteReport, EMPTY_STATS, EMPTY);
logger.assertInfo(
- "Running net.sourceforge.pmd.test.Suite" + NL +
- " Running net.sourceforge.pmd.test.Simple1" + NL +
- " └─ ✘ testFailMethod" + NL +
- " Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.122 s <<< FAILURE! -- in net.sourceforge.pmd.test.Simple1" + NL +
- " Running net.sourceforge.pmd.test.Simple2" + NL +
- " Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.124 s -- in net.sourceforge.pmd.test.Simple2" + NL +
- "Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.371 s <<< FAILURE! -- in net.sourceforge.pmd.test.Suite" + NL
+ "Running net.sourceforge.pmd.test.Suite" + NL
+ + " Running net.sourceforge.pmd.test.Simple1" + NL
+ + " └─ ✘ testFailMethod" + NL
+ + " Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.122 s <<< FAILURE! -- in net.sourceforge.pmd.test.Simple1" + NL
+ + " Running net.sourceforge.pmd.test.Simple2" + NL
+ + " Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.124 s -- in net.sourceforge.pmd.test.Simple2" + NL
+ + "Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.371 s <<< FAILURE! -- in net.sourceforge.pmd.test.Suite" + NL
);
}
@@ -192,8 +193,8 @@ void failForEmptyTestSet() {
reporter.testSetCompleted(wrappedReportEntry, EMPTY_STATS, EMPTY);
logger.assertInfo(
- "Running net.sourceforge.pmd.test.Simple" + NL +
- "Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.123 s -- in net.sourceforge.pmd.test.Simple" + NL
+ "Running net.sourceforge.pmd.test.Simple" + NL
+ + "Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.123 s -- in net.sourceforge.pmd.test.Simple" + NL
);
logger.assertError(
"No tests were executed! Test class: net.sourceforge.pmd.test.Simple" + NL
@@ -203,12 +204,15 @@ void failForEmptyTestSet() {
private SimpleReportEntry createTestSet(String className) {
return createTestSet(className, null);
}
+
private SimpleReportEntry createTestSet(String className, String sourceText) {
return new SimpleReportEntry(RunMode.NORMAL_RUN, testRunId++, className, sourceText, null, null);
}
+
private SimpleReportEntry createTestCase(SimpleReportEntry testSet, String methodName) {
return new SimpleReportEntry(RunMode.NORMAL_RUN, testRunId++, testSet.getSourceName(), null, methodName, null);
}
+
private SimpleReportEntry createTestCaseKotest(SimpleReportEntry testSet, String sourceText) {
return new SimpleReportEntry(RunMode.NORMAL_RUN, testRunId++, testSet.getSourceName(), sourceText, null, null);
}
diff --git a/src/test/java/net/sourceforge/pmd/buildtools/surefire/MockedConsoleLogger.java b/src/test/java/net/sourceforge/pmd/buildtools/surefire/MockedConsoleLogger.java
index 4886021..fdaa03d 100644
--- a/src/test/java/net/sourceforge/pmd/buildtools/surefire/MockedConsoleLogger.java
+++ b/src/test/java/net/sourceforge/pmd/buildtools/surefire/MockedConsoleLogger.java
@@ -1,3 +1,7 @@
+/*
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+
package net.sourceforge.pmd.buildtools.surefire;
import static org.hamcrest.MatcherAssert.assertThat;
diff --git a/src/test/java/net/sourceforge/pmd/buildtools/surefire/junit/TestExecutionListenerTest.java b/src/test/java/net/sourceforge/pmd/buildtools/surefire/junit/TestExecutionListenerTest.java
index 7368318..f2dead8 100644
--- a/src/test/java/net/sourceforge/pmd/buildtools/surefire/junit/TestExecutionListenerTest.java
+++ b/src/test/java/net/sourceforge/pmd/buildtools/surefire/junit/TestExecutionListenerTest.java
@@ -1,3 +1,7 @@
+/*
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+
package net.sourceforge.pmd.buildtools.surefire.junit;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -297,28 +301,28 @@ private static class MyTestDescriptor implements TestDescriptor {
private final UniqueId uniqueId;
private final TestSource source;
- public MyTestDescriptor(String testClass) {
+ MyTestDescriptor(String testClass) {
this.testClass = testClass;
this.type = Type.CONTAINER;
this.uniqueId = UniqueId.forEngine("jupiter").append("class", testClass);
this.source = ClassSource.from(testClass);
}
- public MyTestDescriptor(UniqueId uniqueId, String testClass) {
+ MyTestDescriptor(UniqueId uniqueId, String testClass) {
this.testClass = testClass;
this.type = Type.CONTAINER;
this.uniqueId = uniqueId;
this.source = ClassSource.from(testClass);
}
- public MyTestDescriptor(String testClass, String testMethod) {
+ MyTestDescriptor(String testClass, String testMethod) {
this.testClass = testClass;
this.type = Type.TEST;
this.uniqueId = UniqueId.forEngine("jupiter").append("class", testClass).append("method", testMethod);
this.source = MethodSource.from(testClass, testMethod);
}
- public MyTestDescriptor(String testClass, String[] testMethods, boolean isTest) {
+ MyTestDescriptor(String testClass, String[] testMethods, boolean isTest) {
this.testClass = testClass;
this.type = isTest ? Type.TEST : Type.CONTAINER;
UniqueId uniqueId = UniqueId.forEngine("jupiter").append("class", testClass);