Coverage Report - org.apache.maven.surefire.report.ThreadLocalRunListener
 
Classes in this File Line Coverage Branch Coverage Complexity
ThreadLocalRunListener
0%
0/25
0%
0/2
1.1
 
 1  
 package org.apache.maven.surefire.report;
 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  
 /**
 23  
  * Ensures that the current thread has a RunListener instance attached, and forwards calls to it.
 24  
  * @author Kristian Rosenvold
 25  
  */
 26  
 public class ThreadLocalRunListener implements RunListener
 27  
 {
 28  0
     private final InheritableThreadLocal target = new InheritableThreadLocal();
 29  
 
 30  
     private final ReporterFactory reporterFactory;
 31  
 
 32  
 
 33  
     public RunListener getTarget()
 34  
     {
 35  0
         Object o = target.get();
 36  0
         if (o == null){
 37  0
             o = reporterFactory.createReporter();
 38  0
             target.set(o);
 39  
         }
 40  0
         return (RunListener) o;
 41  
     }
 42  
 
 43  
     public ThreadLocalRunListener(ReporterFactory reporterFactory)
 44  0
     {
 45  0
         this.reporterFactory = reporterFactory;
 46  0
     }
 47  
 
 48  
     public void testSetStarting( ReportEntry report )
 49  
     {
 50  0
         getTarget().testSetStarting( report );
 51  0
     }
 52  
 
 53  
     public void testSetCompleted( ReportEntry report )
 54  
     {
 55  0
         getTarget().testSetCompleted( report );
 56  0
     }
 57  
 
 58  
     public void testStarting( ReportEntry report )
 59  
     {
 60  0
         getTarget().testStarting( report );
 61  0
     }
 62  
 
 63  
     public void testSucceeded( ReportEntry report )
 64  
     {
 65  0
         getTarget().testSucceeded( report );
 66  0
     }
 67  
 
 68  
     public void testAssumptionFailure( ReportEntry report )
 69  
     {
 70  0
         getTarget().testAssumptionFailure( report );
 71  0
     }
 72  
 
 73  
     public void testError( ReportEntry report )
 74  
     {
 75  0
         getTarget().testError( report );
 76  0
     }
 77  
 
 78  
     public void testFailed( ReportEntry report )
 79  
     {
 80  0
         getTarget().testFailed( report );
 81  0
     }
 82  
 
 83  
     public void testSkipped( ReportEntry report )
 84  
     {
 85  0
         getTarget().testSkipped( report );
 86  0
     }
 87  
 
 88  
 }