1 package org.apache.maven.model.converter; 2 3 18 19 import org.codehaus.plexus.PlexusTestCase; 20 import org.codehaus.plexus.util.xml.Xpp3Dom; 21 import org.codehaus.plexus.util.xml.Xpp3DomBuilder; 22 23 import java.io.StringReader ; 24 import java.io.StringWriter ; 25 import java.io.Writer ; 26 27 33 public class V3PomRewriterTest 34 extends PlexusTestCase 35 { 36 private V3PomRewriter rewriter; 37 38 protected void setUp() 39 throws Exception 40 { 41 super.setUp(); 42 43 rewriter = (V3PomRewriter) lookup( V3PomRewriter.ROLE ); 44 } 45 46 public void testCurrentVersionExpressionConversion() 47 throws Exception 48 { 49 String pom = 50 "<project><dependencies><dependency><groupId>g</groupId><artifactId>a</artifactId><version>${pom.currentVersion}</version></dependency></dependencies></project>"; 51 52 Writer to = new StringWriter (); 53 rewriter.rewrite( new StringReader ( pom ), to, false, null, null, null, null ); 54 55 Xpp3Dom dom = Xpp3DomBuilder.build( new StringReader ( to.toString() ) ); 56 String version = dom.getChild( "dependencies" ).getChild( "dependency" ).getChild( "version" ).getValue(); 57 assertEquals( "check new version expression", "${project.version}", version ); 58 } 59 60 } 61 | Popular Tags |