View Javadoc
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  
16  package org.apache.maven.lifecycle.internal.stub;
17  
18  import junit.framework.TestCase;
19  import org.apache.maven.project.MavenProject;
20  
21  import java.util.List;
22  
23  
24  /**
25   * Tests the stub. Yeah, I know.
26   *
27   * @author Kristian Rosenvold
28   */
29  
30  public class ProjectDependencyGraphStubTest
31      extends TestCase
32  {
33      public void testADependencies()
34      {
35          ProjectDependencyGraphStub stub = new ProjectDependencyGraphStub();
36          final List<MavenProject> mavenProjects = stub.getUpstreamProjects( ProjectDependencyGraphStub.A, false );
37          assertEquals( 0, mavenProjects.size() );
38      }
39  
40      public void testBDepenencies( ProjectDependencyGraphStub stub )
41      {
42          final List<MavenProject> bProjects = stub.getUpstreamProjects( ProjectDependencyGraphStub.B, false );
43          assertEquals( 1, bProjects.size() );
44          assertTrue( bProjects.contains( ProjectDependencyGraphStub.A ) );
45      }
46  
47      public void testCDepenencies( ProjectDependencyGraphStub stub )
48      {
49          final List<MavenProject> cProjects = stub.getUpstreamProjects( ProjectDependencyGraphStub.C, false );
50          assertEquals( 1, cProjects.size() );
51          assertTrue( cProjects.contains( ProjectDependencyGraphStub.C ) );
52      }
53  
54      public void testXDepenencies( ProjectDependencyGraphStub stub )
55      {
56          final List<MavenProject> cProjects = stub.getUpstreamProjects( ProjectDependencyGraphStub.X, false );
57          assertEquals( 2, cProjects.size() );
58          assertTrue( cProjects.contains( ProjectDependencyGraphStub.C ) );
59          assertTrue( cProjects.contains( ProjectDependencyGraphStub.B ) );
60      }
61  }