KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > maven > project > ProjectBaseDirectoryAlignmentTest


1 package org.apache.maven.project;
2
3 /*
4  * Copyright 2001-2005 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * 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, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 import org.apache.maven.model.Build;
20 import org.apache.maven.model.Resource;
21
22 import java.io.File JavaDoc;
23
24 public class ProjectBaseDirectoryAlignmentTest
25     extends AbstractMavenProjectTestCase
26 {
27     private String JavaDoc dir = "src/test/resources/projects/base-directory-alignment/";
28
29     public void testProjectDirectoryBaseDirectoryAlignment()
30         throws Exception JavaDoc
31     {
32         File JavaDoc f = getTestFile( dir + "project-which-needs-directory-alignment.xml" );
33
34         MavenProject project = getProject( f );
35
36         assertNotNull( "Test project can't be null!", project );
37
38         assertTrue( project.getBuild().getSourceDirectory().startsWith( getBasedir() ) );
39
40         assertTrue( project.getBuild().getTestSourceDirectory().startsWith( getBasedir() ) );
41
42         Build build = project.getBuild();
43
44         Resource resource = (Resource) build.getResources().get( 0 );
45
46         assertTrue( resource.getDirectory().startsWith( getBasedir() ) );
47     }
48 }
49
Popular Tags