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 016package org.apache.maven.lifecycle.internal.stub; 017 018import junit.framework.TestCase; 019import org.apache.maven.project.MavenProject; 020 021import java.util.List; 022 023 024/** 025 * Tests the stub. Yeah, I know. 026 * 027 * @author Kristian Rosenvold 028 */ 029 030public class ProjectDependencyGraphStubTest 031 extends TestCase 032{ 033 public void testADependencies() 034 { 035 ProjectDependencyGraphStub stub = new ProjectDependencyGraphStub(); 036 final List<MavenProject> mavenProjects = stub.getUpstreamProjects( ProjectDependencyGraphStub.A, false ); 037 assertEquals( 0, mavenProjects.size() ); 038 } 039 040 public void testBDepenencies( ProjectDependencyGraphStub stub ) 041 { 042 final List<MavenProject> bProjects = stub.getUpstreamProjects( ProjectDependencyGraphStub.B, false ); 043 assertEquals( 1, bProjects.size() ); 044 assertTrue( bProjects.contains( ProjectDependencyGraphStub.A ) ); 045 } 046 047 public void testCDepenencies( ProjectDependencyGraphStub stub ) 048 { 049 final List<MavenProject> cProjects = stub.getUpstreamProjects( ProjectDependencyGraphStub.C, false ); 050 assertEquals( 1, cProjects.size() ); 051 assertTrue( cProjects.contains( ProjectDependencyGraphStub.C ) ); 052 } 053 054 public void testXDepenencies( ProjectDependencyGraphStub stub ) 055 { 056 final List<MavenProject> cProjects = stub.getUpstreamProjects( ProjectDependencyGraphStub.X, false ); 057 assertEquals( 2, cProjects.size() ); 058 assertTrue( cProjects.contains( ProjectDependencyGraphStub.C ) ); 059 assertTrue( cProjects.contains( ProjectDependencyGraphStub.B ) ); 060 } 061}