View Javadoc
1   package org.apache.maven.it;
2   
3   import org.apache.maven.it.util.ResourceExtractor;
4   import org.junit.Test;
5   
6   import java.io.File;
7   
8   /**
9    * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-6071">MNG-6071</a>:
10   * check that getClass().getResource("/") returns consistent results when Maven is run with <code>-f ./pom.xml</code>.
11   */
12  public class MavenITmng6071GetResourceWithCustomPom
13      extends AbstractMavenIntegrationTestCase
14  {
15      public MavenITmng6071GetResourceWithCustomPom()
16      {
17          super( "[3.8.2,)" );
18      }
19  
20      /**
21       * check when path to POM set by <code>-f ./pom.xml</code>
22       *
23       * @throws Exception in case of failure
24       */
25      @Test
26      public void testRunCustomPomWithDot( )
27          throws Exception
28      {
29          File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6071" );
30  
31          Verifier verifier = newVerifier( testDir.getAbsolutePath() );
32          verifier.getCliOptions().add( "-f ./pom.xml" );
33          verifier.setForkJvm( true );
34          verifier.executeGoal( "verify" );
35          verifier.verifyErrorFreeLog();
36          verifier.resetStreams();
37      }
38  }