Copilot commented on code in PR #627:
URL: https://github.com/apache/maven-war-plugin/pull/627#discussion_r3652398811
##########
src/test/java/org/apache/maven/plugins/war/overlay/OverlayManagerTest.java:
##########
@@ -125,6 +125,25 @@ void testCustomCurrentProject() throws Exception {
assertEquals(new DefaultOverlay(second), manager.getOverlays().get(2));
}
+ @Test
+ void testNullClassifierMatchesEmptyClassifier() throws Exception {
+ final MavenProjectArtifactsStub project = new
MavenProjectArtifactsStub();
+ final ArtifactStub artifact = newWarArtifact("test", "test-webapp",
"");
+ project.addArtifact(artifact);
+
+ final List<Overlay> overlays = new ArrayList<>();
+ Overlay overlay = new Overlay("test", "test-webapp");
+ overlay.setClassifier(null);
+ overlay.setType("war");
+ overlays.add(overlay);
+
+ final Overlay currentProjectOverlay = Overlay.createInstance();
+ OverlayManager manager =
+ new OverlayManager(overlays, project, DEFAULT_INCLUDES,
DEFAULT_EXCLUDES, currentProjectOverlay);
+ assertNotNull(manager.getOverlays());
+ assertEquals(2, manager.getOverlays().size());
+ }
Review Comment:
The new test only asserts that OverlayManager construction succeeds and that
the overlay list has size 2; it doesn’t verify that the null-classifier overlay
actually got associated to the empty-classifier artifact (so the test would
still pass if classifier comparison were accidentally ignored). Add assertions
that the current project overlay is first and that the configured overlay has
its artifact set to the expected ArtifactStub.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]