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 d248ae7e..cc3606ee 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 junit.framework.TestCase; public class CheckstyleReportListenerMultiSourceTest extends TestCase { - private Map listenerMap; + private Map 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 62df6536..36a352bd 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 @@ * */ public class CheckstyleReportListenerTest extends TestCase { - private Map listenerMap; + private Map 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 3550bbd4..cdcbbc9a 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 @@ * */ 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());