View Javadoc
1   package org.apache.maven.surefire;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import junit.framework.JUnit4TestAdapter;
23  import junit.framework.Test;
24  import junit.framework.TestCase;
25  import junit.framework.TestSuite;
26  import org.apache.maven.plugin.surefire.AbstractSurefireMojoJava7PlusTest;
27  import org.apache.maven.plugin.surefire.AbstractSurefireMojoTest;
28  import org.apache.maven.plugin.surefire.MojoMocklessTest;
29  import org.apache.maven.plugin.surefire.SurefireHelperTest;
30  import org.apache.maven.plugin.surefire.SurefireReflectorTest;
31  import org.apache.maven.plugin.surefire.SurefirePropertiesTest;
32  import org.apache.maven.plugin.surefire.booterclient.BooterDeserializerProviderConfigurationTest;
33  import org.apache.maven.plugin.surefire.booterclient.BooterDeserializerStartupConfigurationTest;
34  import org.apache.maven.plugin.surefire.booterclient.DefaultForkConfigurationTest;
35  import org.apache.maven.plugin.surefire.booterclient.ForkConfigurationTest;
36  import org.apache.maven.plugin.surefire.booterclient.ForkingRunListenerTest;
37  import org.apache.maven.plugin.surefire.booterclient.ModularClasspathForkConfigurationTest;
38  import org.apache.maven.plugin.surefire.booterclient.lazytestprovider.TestLessInputStreamBuilderTest;
39  import org.apache.maven.plugin.surefire.booterclient.lazytestprovider.TestProvidingInputStreamTest;
40  import org.apache.maven.plugin.surefire.report.DefaultReporterFactoryTest;
41  import org.apache.maven.plugin.surefire.report.StatelessXmlReporterTest;
42  import org.apache.maven.plugin.surefire.report.WrappedReportEntryTest;
43  import org.apache.maven.plugin.surefire.runorder.RunEntryStatisticsMapTest;
44  import org.apache.maven.plugin.surefire.util.DependenciesScannerTest;
45  import org.apache.maven.plugin.surefire.util.DirectoryScannerTest;
46  import org.apache.maven.plugin.surefire.util.ScannerUtilTest;
47  import org.apache.maven.plugin.surefire.util.SpecificFileFilterTest;
48  import org.apache.maven.surefire.report.ConsoleOutputFileReporterTest;
49  import org.apache.maven.surefire.report.FileReporterTest;
50  import org.apache.maven.surefire.report.RunStatisticsTest;
51  import org.apache.maven.surefire.spi.SPITest;
52  import org.apache.maven.surefire.util.RelocatorTest;
53  
54  import static org.apache.commons.lang3.JavaVersion.JAVA_1_7;
55  import static org.apache.commons.lang3.JavaVersion.JAVA_RECENT;
56  
57  /**
58   * Adapt the JUnit4 tests which use only annotations to the JUnit3 test suite.
59   *
60   * @author Tibor Digana (tibor17)
61   * @since 2.19
62   */
63  public class JUnit4SuiteTest extends TestCase
64  {
65      public static Test suite()
66      {
67          TestSuite suite = new TestSuite();
68          suite.addTestSuite( RelocatorTest.class );
69          suite.addTestSuite( RunStatisticsTest.class );
70          suite.addTestSuite( FileReporterTest.class );
71          suite.addTestSuite( ConsoleOutputFileReporterTest.class );
72          suite.addTestSuite( SurefirePropertiesTest.class );
73          suite.addTestSuite( SpecificFileFilterTest.class );
74          suite.addTest( new JUnit4TestAdapter( DirectoryScannerTest.class ) );
75          suite.addTestSuite( DependenciesScannerTest.class );
76          suite.addTestSuite( RunEntryStatisticsMapTest.class );
77          suite.addTestSuite( WrappedReportEntryTest.class );
78          suite.addTestSuite( StatelessXmlReporterTest.class );
79          suite.addTestSuite( DefaultReporterFactoryTest.class );
80          suite.addTestSuite( ForkingRunListenerTest.class );
81          suite.addTest( new JUnit4TestAdapter( ForkConfigurationTest.class ) );
82          suite.addTestSuite( BooterDeserializerStartupConfigurationTest.class );
83          suite.addTestSuite( BooterDeserializerProviderConfigurationTest.class );
84          suite.addTest( new JUnit4TestAdapter( TestProvidingInputStreamTest.class ) );
85          suite.addTest( new JUnit4TestAdapter( TestLessInputStreamBuilderTest.class ) );
86          suite.addTest( new JUnit4TestAdapter( SPITest.class ) );
87          suite.addTest( new JUnit4TestAdapter( SurefireReflectorTest.class ) );
88          suite.addTest( new JUnit4TestAdapter( SurefireHelperTest.class ) );
89          suite.addTest( new JUnit4TestAdapter( AbstractSurefireMojoTest.class ) );
90          suite.addTest( new JUnit4TestAdapter( DefaultForkConfigurationTest.class ) );
91          suite.addTest( new JUnit4TestAdapter( ModularClasspathForkConfigurationTest.class ) );
92          if ( JAVA_RECENT.atLeast( JAVA_1_7 ) )
93          {
94              suite.addTest( new JUnit4TestAdapter( AbstractSurefireMojoJava7PlusTest.class ) );
95          }
96          suite.addTest( new JUnit4TestAdapter( ScannerUtilTest.class ) );
97          suite.addTest( new JUnit4TestAdapter( MojoMocklessTest.class ) );
98          return suite;
99      }
100 }