View Javadoc
1   package org.apache.maven.surefire.its.jiras;
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 org.apache.maven.it.VerificationException;
23  import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
24  
25  import org.junit.BeforeClass;
26  import org.junit.Test;
27  
28  /**
29   * SUREFIRE-613 Asserts proper test counts when running in parallel
30   *
31   * @author Kristian Rosenvold
32   */
33  public class Surefire141PluggableProvidersIT
34      extends SurefireJUnit4IntegrationTestCase
35  {
36      @BeforeClass
37      public static void installProvider()
38          throws VerificationException
39      {
40          unpack( Surefire141PluggableProvidersIT.class, "surefire-141-pluggableproviders-provider", "prov" )
41              .executeInstall();
42      }
43  
44      @Test
45      public void pluggableProviderPresent()
46          throws Exception
47      {
48          unpack( "surefire-141-pluggableproviders" )
49              .maven()
50              .showExceptionMessages()
51              .debugLogging()
52              .executeTest()
53              .verifyTextInLog( "Using configured provider org.apache.maven.surefire.testprovider.TestProvider" )
54              .verifyTextInLog( "Using configured provider org.apache.maven.surefire.junit.JUnit3Provider" )
55              .verifyErrorFreeLog();
56      }
57  
58      @Test
59      public void invokeRuntimeException()
60          throws Exception
61      {
62          unpack( "surefire-141-pluggableproviders" )
63              .sysProp( "invokeCrash", "runtimeException" )
64              .maven()
65              .withFailure()
66              .executeTest()
67              .verifyTextInLog( "Let's fail with a runtimeException" );
68      }
69  
70      @Test
71      public void invokeReporterException()
72          throws Exception
73      {
74          unpack( "surefire-141-pluggableproviders" )
75              .sysProp( "invokeCrash", "reporterException" )
76              .maven()
77              .withFailure()
78              .executeTest()
79              .verifyTextInLog( "Let's fail with a reporterexception" );
80      }
81  
82      @Test
83      public void constructorRuntimeException()
84          throws Exception
85      {
86          unpack( "surefire-141-pluggableproviders" )
87              .sysProp( "constructorCrash", "runtimeException" )
88              .maven()
89              .withFailure()
90              .executeTest()
91              .verifyTextInLog( "Let's fail with a runtimeException" );
92      }
93  
94  }