Skip to content

Commit

Permalink
logger
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo committed Dec 20, 2024
1 parent f9a7236 commit 15adf2c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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<CommandLineOption> cli;

Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 15adf2c

Please sign in to comment.