Skip to content

Commit

Permalink
Merge pull request gitflow-incremental-builder#588 from famod/fix-dep…
Browse files Browse the repository at this point in the history
…recations

Fix or suppress deprecation warnings
  • Loading branch information
famod committed Nov 2, 2022
2 parents 05538a5 + e3ac5f0 commit b989e90
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
<maven.compiler.showWarnings>true</maven.compiler.showWarnings>

<!-- Dependency versions -->
<version.jgit>6.3.0.202209071007-r</version.jgit>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ private Builder<?> transformPropertyEnum(Builder<?> builder) {
return builder;
}

@SuppressWarnings("deprecation")
private static Annotation buildMojoAnnotation() {
return new Mojo() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.quality.Strictness;

import io.github.gitflowincrementalbuilder.config.Configuration;
import io.github.gitflowincrementalbuilder.config.Property;
Expand Down Expand Up @@ -116,7 +117,7 @@ protected MavenProject addModuleMock(String moduleArtifactId, boolean addToChang
}

protected MavenProject addModuleMock(String moduleArtifactId, boolean addToChanged, final String packaging) {
MavenProject newModuleMock = mock(MavenProject.class, withSettings().name(moduleArtifactId).lenient());
MavenProject newModuleMock = mock(MavenProject.class, withSettings().name(moduleArtifactId).strictness(Strictness.LENIENT));
allModuleMocks.add(newModuleMock);
when(newModuleMock.getGroupId()).thenReturn("io.github.gitflow-incremental-builder");
when(newModuleMock.getArtifactId()).thenReturn(moduleArtifactId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.mockito.quality.Strictness;

import io.github.gitflowincrementalbuilder.config.Property;

Expand Down Expand Up @@ -832,9 +833,9 @@ private void setUpAndDownstreamsForThreeChainedModules(MavenProject changedModul
}

private static void addMockedTestJarExecution(MavenProject module) {
Plugin pluginMock = mock(Plugin.class, withSettings().lenient());
Plugin pluginMock = mock(Plugin.class, withSettings().strictness(Strictness.LENIENT));
when(pluginMock.getArtifactId()).thenReturn("maven-jar-plugin");
PluginExecution execMock = mock(PluginExecution.class, withSettings().lenient());
PluginExecution execMock = mock(PluginExecution.class, withSettings().strictness(Strictness.LENIENT));
when(execMock.getGoals()).thenReturn(Collections.singletonList("test-jar"));
when(execMock.getConfiguration()).thenReturn(mock(Xpp3Dom.class)); // omit explicit classifier here
when(pluginMock.getExecutions()).thenReturn(Collections.singletonList(execMock));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.SystemReader;
import org.mockito.AdditionalAnswers;
import org.mockito.quality.Strictness;

/**
* Ensures that JGit is isolated from system and user config to avoid inconsistent test results. As JGit does not provide a mechanism to skip user config,
Expand Down Expand Up @@ -43,7 +44,7 @@ public boolean isOutdated() {
// note: cannot directly use Mockito.spy(SystemReader.getInstance()) because org.eclipse.jgit.util.SystemReader.Default is invisible
SystemReader spiedSystemReader = mock(SystemReader.class, withSettings()
.defaultAnswer(AdditionalAnswers.delegatesTo(SystemReader.getInstance()))
.lenient());
.strictness(Strictness.LENIENT));
try {
doReturn(emptyConfig).when(spiedSystemReader).getSystemConfig();
doReturn(emptyConfig).when(spiedSystemReader).getUserConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.maven.execution.ProjectDependencyGraph;
import org.apache.maven.model.Model;
import org.apache.maven.project.MavenProject;
import org.mockito.quality.Strictness;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -37,7 +38,7 @@ public static MavenSession get(Path workDir, Properties topLevelProjectPropertie

MavenProject currentProject = projects.get(0);
currentProject.getModel().setProperties(topLevelProjectProperties);
MavenSession mavenSession = mock(MavenSession.class, withSettings().lenient());
MavenSession mavenSession = mock(MavenSession.class, withSettings().strictness(Strictness.LENIENT));
when(mavenSession.getCurrentProject()).thenReturn(currentProject);
MavenExecutionRequest request = mock(MavenExecutionRequest.class);
when(mavenSession.getRequest()).thenReturn(request);
Expand Down

0 comments on commit b989e90

Please sign in to comment.