View Javadoc
1   package org.apache.maven.it;
2   
3   import java.io.File;
4   
5   import org.apache.maven.it.util.ResourceExtractor;
6   
7   public class MavenITmng5958LifecyclePhaseBinaryCompat
8       extends AbstractMavenIntegrationTestCase
9   {
10  
11      public MavenITmng5958LifecyclePhaseBinaryCompat()
12      {
13          super( "(3.3.9,)" );
14      }
15  
16      public void testGood()
17          throws Exception
18      {
19          File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5958-lifecycle-phases/good" );
20  
21          Verifier verifier = newVerifier( testDir.getAbsolutePath() );
22          verifier.executeGoal( "validate" );
23          verifier.verifyErrorFreeLog();
24          verifier.verifyTextInLog( "CLASS_NAME=java.lang.String" );
25          verifier.resetStreams();
26      }
27  
28      public void testBad()
29          throws Exception
30      {
31          File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5958-lifecycle-phases/bad" );
32  
33          Verifier verifier = newVerifier( testDir.getAbsolutePath() );
34          try
35          {
36              verifier.executeGoal( "validate" );
37          }
38          catch ( VerificationException e )
39          {
40              // There is no good way to test for Java 9+ in Verifier in order to add 'java.base/' to the string.
41              // Java 11: Internal error: java.lang.ClassCastException: class org.apache.maven..
42              verifier.verifyTextInLog( "[ERROR] Internal error: java.lang.ClassCastException: " );
43              verifier.verifyTextInLog( "org.apache.maven.lifecycle.mapping.LifecyclePhase cannot be cast to " );
44          }
45          verifier.resetStreams();
46      }
47  }