You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2026/08/19 19:33:51 UTC
(maven-mapping) branch test/add-baseVersion-coverage created (now b6c5e4e)
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a change to branch test/add-baseVersion-coverage
in repository https://gitbox.apache.org/repos/asf/maven-mapping.git
at b6c5e4e Add tests for @{baseVersion}@ and DEFAULT_FILE_NAME_MAPPING constants
This branch includes the following new commits:
new b6c5e4e Add tests for @{baseVersion}@ and DEFAULT_FILE_NAME_MAPPING constants
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(maven-mapping) 01/01: Add tests for @{baseVersion}@ and DEFAULT_FILE_NAME_MAPPING constants
Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch test/add-baseVersion-coverage
in repository https://gitbox.apache.org/repos/asf/maven-mapping.git
commit b6c5e4ea18f2e579de770b79fc83ab557f6ce0c6
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Wed Aug 19 19:33:35 2026 +0000
Add tests for @{baseVersion}@ and DEFAULT_FILE_NAME_MAPPING constants
Both DEFAULT_FILE_NAME_MAPPING and DEFAULT_FILE_NAME_MAPPING_CLASSIFIER
use @{baseVersion}@ but no test ever exercised this expression or these
constants. Add four tests:
- baseVersionMapping: directly tests @{baseVersion}@ in an expression
- defaultFileNameMapping: tests DEFAULT_FILE_NAME_MAPPING constant
- defaultFileNameMappingClassifier: tests DEFAULT_FILE_NAME_MAPPING_CLASSIFIER with a classifier
- defaultFileNameMappingNullClassifier: tests DEFAULT_FILE_NAME_MAPPING_CLASSIFIER without a classifier
Closes #64
---
.../maven/shared/mapping/MappingUtilsTest.java | 42 ++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/src/test/java/org/apache/maven/shared/mapping/MappingUtilsTest.java b/src/test/java/org/apache/maven/shared/mapping/MappingUtilsTest.java
index 3b080cf..a0fd819 100644
--- a/src/test/java/org/apache/maven/shared/mapping/MappingUtilsTest.java
+++ b/src/test/java/org/apache/maven/shared/mapping/MappingUtilsTest.java
@@ -117,4 +117,46 @@ class MappingUtilsTest {
"maven-test-lib-1.0-classifier.jar",
MappingUtils.evaluateFileNameMapping(mappingWithOptionalClassifier2, jar));
}
+
+ @Test
+ void baseVersionMapping() throws Exception {
+ Artifact jar = new DefaultArtifact(
+ "org.apache.sample", "maven-test-lib", "1.0", null, "jar", null, new DefaultArtifactHandler("jar"));
+ assertEquals(
+ "maven-test-lib-1.0.jar",
+ MappingUtils.evaluateFileNameMapping("@{artifactId}@-@{baseVersion}@.@{extension}@", jar));
+ }
+
+ @Test
+ void defaultFileNameMapping() throws Exception {
+ Artifact jar = new DefaultArtifact(
+ "org.apache.sample", "maven-test-lib", "1.0", null, "jar", null, new DefaultArtifactHandler("jar"));
+ assertEquals(
+ "maven-test-lib-1.0.jar",
+ MappingUtils.evaluateFileNameMapping(MappingUtils.DEFAULT_FILE_NAME_MAPPING, jar));
+ }
+
+ @Test
+ void defaultFileNameMappingClassifier() throws Exception {
+ Artifact jar = new DefaultArtifact(
+ "org.apache.sample",
+ "maven-test-lib",
+ "1.0",
+ null,
+ "jar",
+ "classifier",
+ new DefaultArtifactHandler("jar"));
+ assertEquals(
+ "maven-test-lib-1.0-classifier.jar",
+ MappingUtils.evaluateFileNameMapping(MappingUtils.DEFAULT_FILE_NAME_MAPPING_CLASSIFIER, jar));
+ }
+
+ @Test
+ void defaultFileNameMappingNullClassifier() throws Exception {
+ Artifact jar = new DefaultArtifact(
+ "org.apache.sample", "maven-test-lib", "1.0", null, "jar", null, new DefaultArtifactHandler("jar"));
+ assertEquals(
+ "maven-test-lib-1.0-.jar",
+ MappingUtils.evaluateFileNameMapping(MappingUtils.DEFAULT_FILE_NAME_MAPPING_CLASSIFIER, jar));
+ }
}