001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
003     * agreements. See the NOTICE file distributed with this work for additional information regarding
004     * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
005     * "License"); you may not use this file except in compliance with the License. You may obtain a
006     * copy of the License at
007     *
008     * http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software distributed under the License
011     * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
012     * or implied. See the License for the specific language governing permissions and limitations under
013     * the License.
014     */
015    package org.apache.maven.lifecycle.internal;
016    
017    import junit.framework.TestCase;
018    import org.apache.maven.execution.MavenSession;
019    import org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub;
020    
021    /**
022     * @author Kristian Rosenvold
023     */
024    public class ProjectBuildListTest
025        extends TestCase
026    {
027    
028        public void testGetByTaskSegment()
029            throws Exception
030        {
031            final MavenSession session = ProjectDependencyGraphStub.getMavenSession();
032            ProjectBuildList projectBuildList = ProjectDependencyGraphStub.getProjectBuildList( session );
033            TaskSegment taskSegment = projectBuildList.get( 0 ).getTaskSegment();
034            assertTrue( "This test assumes there are at least 6 elements in projectBuilds", projectBuildList.size() >= 6 );
035    
036            final ProjectBuildList byTaskSegment = projectBuildList.getByTaskSegment( taskSegment );
037            assertEquals( projectBuildList.size(),
038                          byTaskSegment.size() ); // Todo: Make multiple segments on projectBuildList
039        }
040    
041    }