1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.lifecycle.internal;
20
21 import org.apache.maven.execution.MavenSession;
22 import org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub;
23 import org.junit.jupiter.api.Test;
24
25 import static org.hamcrest.MatcherAssert.assertThat;
26 import static org.hamcrest.Matchers.greaterThanOrEqualTo;
27 import static org.hamcrest.Matchers.is;
28 import static org.junit.jupiter.api.Assertions.assertEquals;
29
30
31
32 class ProjectBuildListTest {
33 @Test
34 void testGetByTaskSegment() throws Exception {
35 final MavenSession session = ProjectDependencyGraphStub.getMavenSession();
36 ProjectBuildList projectBuildList = ProjectDependencyGraphStub.getProjectBuildList(session);
37 TaskSegment taskSegment = projectBuildList.get(0).getTaskSegment();
38 assertThat(
39 "This test assumes there are at least 6 elements in projectBuilds",
40 projectBuildList.size(),
41 is(greaterThanOrEqualTo(6)));
42
43 final ProjectBuildList byTaskSegment = projectBuildList.getByTaskSegment(taskSegment);
44 assertEquals(projectBuildList.size(), byTaskSegment.size());
45 }
46 }