Coverage Report - org.kuali.maven.wagon.PercentCompleteTracker
 
Classes in this File Line Coverage Branch Coverage Complexity
PercentCompleteTracker
75%
9/12
50%
2/4
1.25
 
 1  
 package org.kuali.maven.wagon;
 2  
 
 3  
 /**
 4  
  * Print a dot whenever there is progress of 2% or more
 5  
  */
 6  1
 public class PercentCompleteTracker extends ProgressTracker {
 7  1
     int percentageIncrement = 2;
 8  
     int percentCompletePrevious;
 9  
 
 10  
     @Override
 11  
     protected void showProgress(int count, int total) {
 12  38
         int percentComplete = (count * 100) / total;
 13  38
         if (enoughProgress(percentComplete)) {
 14  38
             percentCompletePrevious = percentComplete;
 15  38
             out.print(progressToken);
 16  
         }
 17  38
     }
 18  
 
 19  
     protected boolean enoughProgress(int percentComplete) {
 20  38
         int needed = percentCompletePrevious + percentageIncrement;
 21  38
         return percentComplete >= needed;
 22  
     }
 23  
 
 24  
     public int getPercentageIncrement() {
 25  0
         return percentageIncrement;
 26  
     }
 27  
 
 28  
     public void setPercentageIncrement(int percentageIncrement) {
 29  0
         this.percentageIncrement = percentageIncrement;
 30  0
     }
 31  
 
 32  
 }