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
33 class ProjectBuildListTest {
34 @Test
35 void testGetByTaskSegment() throws Exception {
36 final MavenSession session = ProjectDependencyGraphStub.getMavenSession();
37 ProjectBuildList projectBuildList = ProjectDependencyGraphStub.getProjectBuildList(session);
38 TaskSegment taskSegment = projectBuildList.get(0).getTaskSegment();
39 assertThat(
40 "This test assumes there are at least 6 elements in projectBuilds",
41 projectBuildList.size(),
42 is(greaterThanOrEqualTo(6)));
43
44 final ProjectBuildList byTaskSegment = projectBuildList.getByTaskSegment(taskSegment);
45 assertEquals(projectBuildList.size(), byTaskSegment.size());
46 }
47 }