Coverage Report - org.apache.maven.surefire.junit4.MockReporter
 
Classes in this File Line Coverage Branch Coverage Complexity
MockReporter
61%
16/26
N/A
1
 
 1  
 package org.apache.maven.surefire.junit4;
 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.ArrayList;
 23  
 import java.util.List;
 24  
 import java.util.concurrent.atomic.AtomicInteger;
 25  
 import org.apache.maven.surefire.report.ReportEntry;
 26  
 import org.apache.maven.surefire.report.RunListener;
 27  
 
 28  
 /**
 29  
  * Internal use only
 30  
  */
 31  
 public class MockReporter
 32  
     implements RunListener
 33  
 {
 34  2
     private final List<String> events = new ArrayList<String>();
 35  
 
 36  
     public static final String SET_STARTED = "SET_STARTED";
 37  
 
 38  
     public static final String SET_COMPLETED = "SET_COMPLETED";
 39  
 
 40  
     public static final String TEST_STARTED = "TEST_STARTED";
 41  
 
 42  
     public static final String TEST_COMPLETED = "TEST_COMPLETED";
 43  
 
 44  
     public static final String TEST_SKIPPED = "TEST_SKIPPED";
 45  
 
 46  2
     private final AtomicInteger testSucceeded = new AtomicInteger();
 47  
 
 48  2
     private final AtomicInteger testIgnored = new AtomicInteger();
 49  
 
 50  2
     private final AtomicInteger testFailed = new AtomicInteger();
 51  
 
 52  2
     private final AtomicInteger testError = new AtomicInteger();
 53  
 
 54  
     public MockReporter()
 55  2
     {
 56  2
     }
 57  
 
 58  
     public void testSetStarting( ReportEntry report )
 59  
     {
 60  0
         events.add( SET_STARTED );
 61  0
     }
 62  
 
 63  
     public void testSetCompleted( ReportEntry report )
 64  
     {
 65  0
         events.add( SET_COMPLETED );
 66  0
     }
 67  
 
 68  
     public void testStarting( ReportEntry report )
 69  
     {
 70  4
         events.add( TEST_STARTED );
 71  4
     }
 72  
 
 73  
     public void testSucceeded( ReportEntry report )
 74  
     {
 75  3
         events.add( TEST_COMPLETED );
 76  3
         testSucceeded.incrementAndGet();
 77  
 
 78  3
     }
 79  
 
 80  
     public void testSkipped( ReportEntry report )
 81  
     {
 82  0
         events.add( TEST_SKIPPED );
 83  0
         testIgnored.incrementAndGet();
 84  0
     }
 85  
 
 86  
     public int getTestSucceeded()
 87  
     {
 88  1
         return testSucceeded.get();
 89  
     }
 90  
 
 91  
     public int getTestFailed()
 92  
     {
 93  1
         return testFailed.get();
 94  
     }
 95  
 
 96  
     public void testError( ReportEntry report )
 97  
     {
 98  0
         testError.incrementAndGet();
 99  0
     }
 100  
 
 101  
     public void testFailed( ReportEntry report )
 102  
     {
 103  1
         testFailed.incrementAndGet();
 104  1
     }
 105  
 
 106  
     public void testAssumptionFailure( ReportEntry report )
 107  
     {
 108  0
     }
 109  
 
 110  
 }