desruisseaux commented on code in PR #11639:
URL: https://github.com/apache/maven/pull/11639#discussion_r2880341665


##########
impl/maven-core/src/test/java/org/apache/maven/internal/transformation/impl/ConsumerPomBuilderTest.java:
##########
@@ -108,39 +116,50 @@ void testTrivialConsumer() throws Exception {
 
         MavenProject project = new MavenProject(orgModel);
         project.setOriginalModel(new org.apache.maven.model.Model(orgModel));
+        return project;
+    }
+
+    @Test
+    void testTrivialConsumer() throws Exception {
+        setRootDirectory("trivial");
+        Path file = 
Paths.get("src/test/resources/consumer/trivial/child/pom.xml");
+
+        MavenProject project = getEffectiveModel(file);
         Model model = builder.build(session, project, 
Sources.buildSource(file));
 
         assertNotNull(model);
+        assertNotNull(model.getDependencies());
     }
 
     @Test
     void testSimpleConsumer() throws Exception {
-        MavenExecutionRequest request = 
InternalMavenSession.from(InternalSession.from(session))
-                .getMavenSession()
-                .getRequest();
-        
request.setRootDirectory(Paths.get("src/test/resources/consumer/simple"));
+        MavenExecutionRequest request = setRootDirectory("simple");
         request.getUserProperties().setProperty("changelist", "MNG6957");
-
         Path file = 
Paths.get("src/test/resources/consumer/simple/simple-parent/simple-weather/pom.xml");
 
-        ModelBuilder.ModelBuilderSession mbs = modelBuilder.newSession();
-        
InternalSession.from(session).getData().set(SessionData.key(ModelBuilder.ModelBuilderSession.class),
 mbs);
-        Model orgModel = mbs.build(ModelBuilderRequest.builder()
-                        .session(InternalSession.from(session))
-                        .source(Sources.buildSource(file))
-                        
.requestType(ModelBuilderRequest.RequestType.BUILD_PROJECT)
-                        .build())
-                .getEffectiveModel();
-
-        MavenProject project = new MavenProject(orgModel);
-        project.setOriginalModel(new org.apache.maven.model.Model(orgModel));
+        MavenProject project = getEffectiveModel(file);
         
request.setRootDirectory(Paths.get("src/test/resources/consumer/simple"));
         Model model = builder.build(session, project, 
Sources.buildSource(file));
 
         assertNotNull(model);
+        assertFalse(model.getDependencies().isEmpty());
         assertTrue(model.getProfiles().isEmpty());
     }
 
+    @Test
+    void testMultiModuleConsumer() throws Exception {
+        setRootDirectory("multi-module");
+        Path file = 
Paths.get("src/test/resources/consumer/multi-module/pom.xml");
+
+        MavenProject project = getEffectiveModel(file);
+        Model model = builder.build(session, project, 
Sources.buildSource(file));
+
+        assertNotNull(model);
+        assertNull(model.getBuild());
+        assertTrue(model.getDependencies().isEmpty());
+        
assertFalse(model.getDependencyManagement().getDependencies().isEmpty());
+    }

Review Comment:
   Added the test, thanks. Note: I tried `Authored-by: Gerd …` instead of 
`Co-authored-by:` since I did no change, but it didn't work. It will be fixed 
when we will squash all the commits.



-- 
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]

Reply via email to