Coverage Report - org.apache.maven.plugin.surefire.booterclient.MockReporter
 
Classes in this File Line Coverage Branch Coverage Complexity
MockReporter
0%
0/46
0%
0/2
1.067
 
 1  
 package org.apache.maven.plugin.surefire.booterclient;
 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.ConsoleOutputReceiver;
 26  
 import org.apache.maven.surefire.report.ConsoleLogger;
 27  
 import org.apache.maven.surefire.report.ReportEntry;
 28  
 import org.apache.maven.surefire.report.RunListener;
 29  
 
 30  
 /**
 31  
  * Internal use only
 32  
  */
 33  
 public class MockReporter
 34  
     implements RunListener, ConsoleLogger, ConsoleOutputReceiver
 35  
 {
 36  0
     private final List events = new ArrayList();
 37  
 
 38  0
     private final List data = new ArrayList();
 39  
 
 40  
     public static final String SET_STARTING = "SET_STARTED";
 41  
 
 42  
     public static final String SET_COMPLETED = "SET_COMPLETED";
 43  
 
 44  
     public static final String TEST_STARTING = "TEST_STARTED";
 45  
 
 46  
     public static final String TEST_SUCCEEDED = "TEST_COMPLETED";
 47  
 
 48  
     public static final String TEST_FAILED = "TEST_FAILED";
 49  
 
 50  
     public static final String TEST_ERROR = "TEST_ERROR";
 51  
 
 52  
     public static final String TEST_SKIPPED = "TEST_SKIPPED";
 53  
 
 54  
     public static final String TEST_ASSUMPTION_FAIL = "TEST_ASSUMPTION_SKIPPED";
 55  
 
 56  
     public static final String CONSOLE_OUTPUT = "CONSOLE_OUTPUT";
 57  
 
 58  
     public static final String STDOUT = "STDOUT";
 59  
 
 60  
     public static final String STDERR = "STDERR";
 61  
 
 62  0
     private final AtomicInteger testSucceeded = new AtomicInteger();
 63  
 
 64  0
     private final AtomicInteger testIgnored = new AtomicInteger();
 65  
 
 66  0
     private final AtomicInteger testFailed = new AtomicInteger();
 67  
 
 68  
     public MockReporter()
 69  0
     {
 70  0
     }
 71  
 
 72  
     public void testSetStarting( ReportEntry report )
 73  
     {
 74  0
         events.add( SET_STARTING );
 75  0
         data.add( report );
 76  0
     }
 77  
 
 78  
     public void testSetCompleted( ReportEntry report )
 79  
     {
 80  0
         events.add( SET_COMPLETED );
 81  0
         data.add( report );
 82  0
     }
 83  
 
 84  
     public void testStarting( ReportEntry report )
 85  
     {
 86  0
         events.add( TEST_STARTING );
 87  0
         data.add( report );
 88  0
     }
 89  
 
 90  
     public void testSucceeded( ReportEntry report )
 91  
     {
 92  0
         events.add( TEST_SUCCEEDED );
 93  0
         testSucceeded.incrementAndGet();
 94  0
         data.add( report );
 95  0
     }
 96  
 
 97  
     public void testError( ReportEntry report )
 98  
     {
 99  0
         events.add( TEST_ERROR );
 100  0
         data.add( report );
 101  0
         testFailed.incrementAndGet();
 102  0
     }
 103  
 
 104  
     public void testFailed( ReportEntry report )
 105  
     {
 106  0
         events.add( TEST_FAILED );
 107  0
         data.add( report );
 108  0
         testFailed.incrementAndGet();
 109  0
     }
 110  
 
 111  
 
 112  
     public void testSkipped( ReportEntry report )
 113  
     {
 114  0
         events.add( TEST_SKIPPED );
 115  0
         data.add( report );
 116  0
         testIgnored.incrementAndGet();
 117  0
     }
 118  
 
 119  
 
 120  
     public List getEvents()
 121  
     {
 122  0
         return events;
 123  
     }
 124  
 
 125  
     public List getData()
 126  
     {
 127  0
         return data;
 128  
     }
 129  
 
 130  
     public String getFirstEvent()
 131  
     {
 132  0
         return (String) events.get( 0 );
 133  
     }
 134  
 
 135  
     public ReportEntry getFirstData()
 136  
     {
 137  0
         return (ReportEntry) data.get( 0 );
 138  
     }
 139  
 
 140  
 
 141  
     public void testAssumptionFailure( ReportEntry report )
 142  
     {
 143  0
         events.add( TEST_ASSUMPTION_FAIL );
 144  0
         data.add( report );
 145  0
         testIgnored.incrementAndGet();
 146  
 
 147  0
     }
 148  
 
 149  
     public void info( String message )
 150  
     {
 151  0
         events.add( CONSOLE_OUTPUT );
 152  0
         data.add( message );
 153  
         //To change body of implemented methods use File | Settings | File Templates.
 154  0
     }
 155  
 
 156  
     public void writeTestOutput( byte[] buf, int off, int len, boolean stdout )
 157  
     {
 158  0
         events.add( stdout ? STDOUT : STDERR );
 159  0
         data.add( new String( buf, off, len ) );
 160  0
     }
 161  
 }