1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.maven.project.inheritance.t01; 20 21 import org.apache.maven.project.MavenProject; 22 import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; 23 import org.junit.jupiter.api.Test; 24 25 import static org.junit.jupiter.api.Assertions.assertEquals; 26 27 /** 28 * A test which demonstrates maven's recursive inheritance where 29 * we are testing to make sure that elements stated in a model are 30 * not clobbered by the same elements elsewhere in the lineage. 31 * 32 */ 33 @Deprecated 34 class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase { 35 // ---------------------------------------------------------------------- 36 // 37 // p4 inherits from p3 38 // p3 inherits from p2 39 // p2 inherits from p1 40 // p1 inherits from p0 41 // p0 inherits from super model 42 // 43 // or we can show it graphically as: 44 // 45 // p4 ---> p3 ---> p2 ---> p1 ---> p0 --> super model 46 // 47 // ---------------------------------------------------------------------- 48 49 @Test 50 void testProjectInheritance() throws Exception { 51 // ---------------------------------------------------------------------- 52 // Check p0 value for org name 53 // ---------------------------------------------------------------------- 54 55 MavenProject p0 = getProject(projectFile("maven.t01", "p0")); 56 57 assertEquals("p0-org", p0.getOrganization().getName()); 58 59 // ---------------------------------------------------------------------- 60 // Check p1 value for org name 61 // ---------------------------------------------------------------------- 62 63 MavenProject p1 = getProject(projectFile("maven.t01", "p1")); 64 65 assertEquals("p1-org", p1.getOrganization().getName()); 66 67 // ---------------------------------------------------------------------- 68 // Check p2 value for org name 69 // ---------------------------------------------------------------------- 70 71 MavenProject p2 = getProject(projectFile("maven.t01", "p2")); 72 73 assertEquals("p2-org", p2.getOrganization().getName()); 74 75 // ---------------------------------------------------------------------- 76 // Check p2 value for org name 77 // ---------------------------------------------------------------------- 78 79 MavenProject p3 = getProject(projectFile("maven.t01", "p3")); 80 81 assertEquals("p3-org", p3.getOrganization().getName()); 82 83 // ---------------------------------------------------------------------- 84 // Check p4 value for org name 85 // ---------------------------------------------------------------------- 86 87 MavenProject p4 = getProject(projectFile("maven.t01", "p4")); 88 89 assertEquals("p4-org", p4.getOrganization().getName()); 90 } 91 }