diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/VerifyMojo.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/VerifyMojo.java index 486ccbc6bd..f0409a1c22 100644 --- a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/VerifyMojo.java +++ b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/VerifyMojo.java @@ -153,6 +153,7 @@ public class VerifyMojo extends AbstractMojo implements SurefireReportParameters * * @deprecated since of 2.20.1 */ + @Deprecated @Parameter(property = "encoding", defaultValue = "${project.reporting.outputEncoding}") private String encoding; @@ -162,7 +163,7 @@ public class VerifyMojo extends AbstractMojo implements SurefireReportParameters @Parameter(defaultValue = "${session}", readonly = true) private MavenSession session; - private Logger logger; + private final Logger logger; private Collection cli; @@ -204,10 +205,6 @@ private Exception getBooterForkException(RunResult summary) { return null; } - void setLogger(Logger logger) { - this.logger = logger; - } - private PluginConsoleLogger getConsoleLogger() { if (consoleLogger == null) { synchronized (this) { diff --git a/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/VerifyMojoTest.java b/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/VerifyMojoTest.java index 3d712584c3..4d90aa45f6 100644 --- a/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/VerifyMojoTest.java +++ b/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/VerifyMojoTest.java @@ -36,28 +36,26 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -/** - */ public class VerifyMojoTest { private VerifyMojo mojo; @Rule public TemporaryFolder tempFolder = new TemporaryFolder(); + private Logger logger = mock(Logger.class); + @Before public void init() throws UnsupportedEncodingException { - mojo = new VerifyMojo(); + mojo = new VerifyMojo(logger); mojo.setTestClassesDirectory(tempFolder.getRoot()); mojo.setReportsDirectory(getTestBaseDir()); } private void setupExecuteMocks() { - Logger logger = mock(Logger.class); when(logger.isErrorEnabled()).thenReturn(true); when(logger.isWarnEnabled()).thenReturn(true); when(logger.isInfoEnabled()).thenReturn(true); when(logger.isDebugEnabled()).thenReturn(false); - mojo.setLogger(logger); MavenSession session = mock(MavenSession.class); MavenExecutionRequest request = mock(MavenExecutionRequest.class);