1   package org.apache.maven.release;
2   
3   /* ====================================================================
4    *   Copyright 2001-2004 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  
20  import java.io.File;
21  import java.util.List;
22  
23  import junit.framework.TestCase;
24  
25  import org.dom4j.Node;
26  
27  /**
28   */
29  public class SnapshotResolverTest
30      extends TestCase
31  {
32  
33      /**
34       * Constructor.
35       *
36       * @param name Name of the test.
37       */
38      public SnapshotResolverTest( String name )
39      {
40          super( name );
41      }
42  
43      public void testBasic()
44          throws Exception
45      {
46          DummySnapshotResolver sr = new DummySnapshotResolver();
47          sr.setProject( new File( getClass().getResource( "/test-pom.xml" ).getFile() ) );
48          sr.transformNodes();
49          sr.write();
50  
51          List nodes = sr.getDocument().selectNodes( "/project/dependencies/dependency" );
52  
53          assertEquals( 3, nodes.size() );
54  
55          assertEquals( "NON-SNAPSHOT", ( (Node) nodes.get( 0 ) ).selectSingleNode( "version" ).getText() );
56          assertEquals( "NON-SNAPSHOT", ( (Node) nodes.get( 1 ) ).selectSingleNode( "version" ).getText() );
57          assertEquals( "NON-SNAPSHOT", ( (Node) nodes.get( 2 ) ).selectSingleNode( "version" ).getText() );
58      }
59  }