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