Skip to content

Commit

Permalink
[MSHARED-1367] Improvement in unit tests
Browse files Browse the repository at this point in the history
- use Mockito instead of own mock classes
  • Loading branch information
slawekjaranowski committed Mar 24, 2024
1 parent 5b99cd7 commit f6a41b5
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 430 deletions.
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@
<version>3.25.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/apache/maven/archiver/MavenArchiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,7 @@ public void createArchive(
File pomPropertiesFile = new File(dir, "pom.properties");

new PomPropertiesUtil()
.createPomProperties(
session, workingProject, archiver, customPomPropertiesFile, pomPropertiesFile, forced);
.createPomProperties(workingProject, archiver, customPomPropertiesFile, pomPropertiesFile, forced);
}

// ----------------------------------------------------------------------
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ private void createPropertiesFile(Properties properties, File outputFile, boolea
* @param forceCreation force creation true/false
* @throws org.codehaus.plexus.archiver.ArchiverException archiver exception.
* @throws java.io.IOException IO exception.
* @deprecated please use {@link #createPomProperties(MavenProject, Archiver, File, File, boolean)}
*/
@Deprecated
public void createPomProperties(
MavenSession session,
MavenProject project,
Expand All @@ -112,6 +114,27 @@ public void createPomProperties(
File pomPropertiesFile,
boolean forceCreation)
throws IOException {
createPomProperties(project, archiver, customPomPropertiesFile, pomPropertiesFile, forceCreation);
}

/**
* Creates the pom.properties file.
*
* @param project {@link org.apache.maven.project.MavenProject}
* @param archiver {@link org.codehaus.plexus.archiver.Archiver}
* @param customPomPropertiesFile optional custom pom properties file
* @param pomPropertiesFile The pom properties file.
* @param forceCreation force creation true/false
* @throws org.codehaus.plexus.archiver.ArchiverException archiver exception.
* @throws java.io.IOException IO exception.
*/
public void createPomProperties(
MavenProject project,
Archiver archiver,
File customPomPropertiesFile,
File pomPropertiesFile,
boolean forceCreation)
throws IOException {
final String groupId = project.getGroupId();
final String artifactId = project.getArtifactId();
final String version = project.getVersion();
Expand Down
Loading

0 comments on commit f6a41b5

Please sign in to comment.