Coverage Report - org.apache.maven.plugin.surefire.runorder.Priority
 
Classes in this File Line Coverage Branch Coverage Complexity
Priority
50%
9/18
N/A
1
 
 1  
 package org.apache.maven.plugin.surefire.runorder;
 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  
  * @author Kristian Rosenvold
 24  
  */
 25  
 public class Priority
 26  
 {
 27  
     private final String className;
 28  
 
 29  
     int priority;
 30  
 
 31  10
     int totalRuntime = 0;
 32  
 
 33  10
     int minSuccessRate = Integer.MAX_VALUE;
 34  
 
 35  
     public Priority( String className )
 36  10
     {
 37  10
         this.className = className;
 38  10
     }
 39  
 
 40  
     /**
 41  
      * Returns a priority that applies to a new testclass (that has never been run/recorded)
 42  
      *
 43  
      * @param className The class name
 44  
      * @return A priority
 45  
      */
 46  
     public static Priority newTestClassPriority( String className )
 47  
     {
 48  0
         Priority priority1 = new Priority( className );
 49  0
         priority1.setPriority( 0 );
 50  0
         priority1.minSuccessRate = 0;
 51  0
         return priority1;
 52  
     }
 53  
 
 54  
     public void addItem( RunEntryStatistics itemStat )
 55  
     {
 56  16
         totalRuntime += itemStat.getRunTime();
 57  16
         minSuccessRate = Math.min( minSuccessRate, itemStat.getSuccessfulBuilds() );
 58  16
     }
 59  
 
 60  
 
 61  
     public int getTotalRuntime()
 62  
     {
 63  10
         return totalRuntime;
 64  
     }
 65  
 
 66  
     public int getMinSuccessRate()
 67  
     {
 68  0
         return minSuccessRate;
 69  
     }
 70  
 
 71  
     public String getClassName()
 72  
     {
 73  0
         return className;
 74  
     }
 75  
 
 76  
     public int getPriority()
 77  
     {
 78  0
         return priority;
 79  
     }
 80  
 
 81  
     public void setPriority( int priority )
 82  
     {
 83  0
         this.priority = priority;
 84  0
     }
 85  
 }