1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
3    * agreements. See the NOTICE file distributed with this work for additional information regarding
4    * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
5    * "License"); you may not use this file except in compliance with the License. You may obtain a
6    * copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software distributed under the License
11   * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing permissions and limitations under
13   * the License.
14   */
15  package org.apache.maven.lifecycle.internal;
16  
17  import junit.framework.TestCase;
18  import org.apache.maven.execution.MavenSession;
19  import org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub;
20  
21  /**
22   * @author Kristian Rosenvold
23   */
24  public class ProjectBuildListTest
25      extends TestCase
26  {
27  
28      public void testGetByTaskSegment()
29          throws Exception
30      {
31          final MavenSession session = ProjectDependencyGraphStub.getMavenSession();
32          ProjectBuildList projectBuildList = ProjectDependencyGraphStub.getProjectBuildList( session );
33          TaskSegment taskSegment = projectBuildList.get( 0 ).getTaskSegment();
34          assertTrue( "This test assumes there are at least 6 elements in projectBuilds", projectBuildList.size() >= 6 );
35  
36          final ProjectBuildList byTaskSegment = projectBuildList.getByTaskSegment( taskSegment );
37          assertEquals( projectBuildList.size(),
38                        byTaskSegment.size() ); // Todo: Make multiple segments on projectBuildList
39      }
40  
41  }