This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-checkstyle-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new b0ce8f7  Remove needless cleanup (#162)
b0ce8f7 is described below

commit b0ce8f7a16638400c22cfad23ad2656369c45023
Author: Elliotte Rusty Harold <elh...@users.noreply.github.com>
AuthorDate: Sun Nov 24 13:09:43 2024 +0000

    Remove needless cleanup (#162)
---
 .../exec/CheckstyleReportListenerMultiSourceTest.java        |  5 ++---
 .../checkstyle/exec/CheckstyleReportListenerTest.java        |  5 ++---
 .../maven/plugins/checkstyle/exec/CheckstyleResultsTest.java | 12 +-----------
 3 files changed, 5 insertions(+), 17 deletions(-)

diff --git 
a/src/test/java/org/apache/maven/plugins/checkstyle/exec/CheckstyleReportListenerMultiSourceTest.java
 
b/src/test/java/org/apache/maven/plugins/checkstyle/exec/CheckstyleReportListenerMultiSourceTest.java
index d248ae7..cc3606e 100644
--- 
a/src/test/java/org/apache/maven/plugins/checkstyle/exec/CheckstyleReportListenerMultiSourceTest.java
+++ 
b/src/test/java/org/apache/maven/plugins/checkstyle/exec/CheckstyleReportListenerMultiSourceTest.java
@@ -28,14 +28,13 @@ import com.puppycrawl.tools.checkstyle.api.Violation;
 import junit.framework.TestCase;
 
 public class CheckstyleReportListenerMultiSourceTest extends TestCase {
-    private Map<SeverityLevel, CheckstyleCheckerListener> listenerMap;
+    private Map<SeverityLevel, CheckstyleCheckerListener> listenerMap = new 
HashMap<>();
 
     /**
      * {@inheritDoc}
      */
+    @Override
     protected void setUp() throws Exception {
-        listenerMap = new HashMap<>();
-
         CheckstyleCheckerListener listener = new CheckstyleCheckerListener(new 
File("/source/path"));
         listener.addSourceDirectory(new File("/source/path2"));
         listener.setSeverityLevelFilter(SeverityLevel.INFO);
diff --git 
a/src/test/java/org/apache/maven/plugins/checkstyle/exec/CheckstyleReportListenerTest.java
 
b/src/test/java/org/apache/maven/plugins/checkstyle/exec/CheckstyleReportListenerTest.java
index 62df653..36a352b 100644
--- 
a/src/test/java/org/apache/maven/plugins/checkstyle/exec/CheckstyleReportListenerTest.java
+++ 
b/src/test/java/org/apache/maven/plugins/checkstyle/exec/CheckstyleReportListenerTest.java
@@ -32,12 +32,11 @@ import junit.framework.TestCase;
  *
  */
 public class CheckstyleReportListenerTest extends TestCase {
-    private Map<SeverityLevel, CheckstyleCheckerListener> listenerMap;
+    private Map<SeverityLevel, CheckstyleCheckerListener> listenerMap = new 
HashMap<>();
 
     /** {@inheritDoc} */
+    @Override
     protected void setUp() throws Exception {
-        listenerMap = new HashMap<>();
-
         CheckstyleCheckerListener listener = new CheckstyleCheckerListener(new 
File("/source/path"));
         listener.setSeverityLevelFilter(SeverityLevel.INFO);
         listenerMap.put(listener.getSeverityLevelFilter(), listener);
diff --git 
a/src/test/java/org/apache/maven/plugins/checkstyle/exec/CheckstyleResultsTest.java
 
b/src/test/java/org/apache/maven/plugins/checkstyle/exec/CheckstyleResultsTest.java
index 3550bbd..cdcbbc9 100644
--- 
a/src/test/java/org/apache/maven/plugins/checkstyle/exec/CheckstyleResultsTest.java
+++ 
b/src/test/java/org/apache/maven/plugins/checkstyle/exec/CheckstyleResultsTest.java
@@ -34,17 +34,7 @@ import junit.framework.TestCase;
  *
  */
 public class CheckstyleResultsTest extends TestCase {
-    private CheckstyleResults results;
-
-    /** {@inheritDoc} */
-    protected void setUp() throws Exception {
-        results = new CheckstyleResults();
-    }
-
-    /** {@inheritDoc} */
-    protected void tearDown() throws Exception {
-        results = null;
-    }
+    private CheckstyleResults results = new CheckstyleResults();
 
     public void testEmptyResults() {
         assertEquals("test total files", 0, results.getFiles().size());

Reply via email to