View Javadoc
1   package org.apache.maven.surefire.its;
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 java.util.Collection;
23  
24  import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
25  import org.apache.maven.surefire.its.fixture.SurefireLauncher;
26  import org.junit.Test;
27  import org.junit.runner.RunWith;
28  import org.junit.runners.Parameterized;
29  import org.junit.runners.Parameterized.Parameter;
30  
31  import static java.util.Arrays.asList;
32  import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_10;
33  import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_11;
34  import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_12;
35  import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_8;
36  import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_8_1;
37  import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_8_2;
38  import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_9;
39  import static org.junit.runners.Parameterized.*;
40  
41  import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_0;
42  import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_1;
43  import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_2;
44  import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_3;
45  import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_3_1;
46  import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_4;
47  import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_5;
48  import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_6;
49  import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_7;
50  
51  /**
52   * Basic suite test using all known versions of JUnit 4.x
53   *
54   * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
55   */
56  @RunWith( Parameterized.class )
57  public class JUnit4VersionsIT
58      extends SurefireJUnit4IntegrationTestCase
59  {
60  
61      @Parameters( name = "{index}: JUnit {0}" )
62      public static Collection<Object[]> junitVersions()
63      {
64          return asList( new Object[][] {
65                  { JUNIT_4_0 },
66                  { JUNIT_4_1 },
67                  { JUNIT_4_2 },
68                  { JUNIT_4_3 },
69                  { JUNIT_4_3_1 },
70                  { JUNIT_4_4 },
71                  { JUNIT_4_5 },
72                  { JUNIT_4_6 },
73                  { JUNIT_4_7 },
74                  { JUNIT_4_8 },
75                  { JUNIT_4_8_1 },
76                  { JUNIT_4_8_2 },
77                  { JUNIT_4_9 },
78                  { JUNIT_4_10 },
79                  { JUNIT_4_11 },
80                  { JUNIT_4_12 }
81          } );
82      }
83  
84      @Parameter
85      public JUnitVersion version;
86  
87      @Test
88      public void testJunit()
89      {
90          version.configure( unpack() )
91                  .executeTest()
92                  .verifyErrorFree( 1 );
93      }
94  
95      private SurefireLauncher unpack()
96      {
97          return unpack( "/junit4", version.toString() );
98      }
99  }