elharo commented on code in PR #2375:
URL: https://github.com/apache/maven/pull/2375#discussion_r2111578166


##########
impl/maven-core/src/test/java/org/apache/maven/artifact/handler/ArtifactHandlerTest.java:
##########
@@ -77,8 +107,15 @@ void testAptConsistency() throws Exception {
                 ArtifactHandler handler =
                         
container.lookup(ArtifactHandlerManager.class).getArtifactHandler(type);
                 assertEquals(handler.getExtension(), extension, type + " 
extension");
-                // Packaging/Directory is Maven1 remnant!!!
-                // assertEquals(handler.getPackaging(), packaging, type + " 
packaging");
+                assertThat(PACKAGING_TYPES).contains(handler.getPackaging(), 
packaging);
+                if (handler.getPackaging().equals("test-jar")) {
+                    assertEquals("jar", packaging);
+
+                } else if (handler.getPackaging().equals("ejb-client")) {
+                    assertEquals("ejb", packaging);

Review Comment:
   I might be starting to see what's going on here. I think you're hitting a 
weird issue (though WAI) about file extension vs dependency type. See 
https://maven.apache.org/ref/3.9.9/maven-core/artifact-handlers.html and pages 
I can't put my finger on right now, but updated a few months ago.
   
   That being said, I am more convinced now that this approach is incorrect. We 
want one single assertEquals that tests a specific value, not contains 
something from a collection and not "if this assert that". This might mean 
splitting into multiple test methods. DRY does not apply to tests and asserts. 
*Unit* tests should be very straight-forward with no branching and no 
conditionals. 



-- 
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: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to