Coverage Report - jaggregate.internal.ArgumentChecks
 
Classes in this File Line Coverage Branch Coverage Complexity
ArgumentChecks
100%
5/5
100%
1/1
0
 
 1  
 /*
 2  
  Copyright 2004-2008 Paul R. Holser, Jr.  All rights reserved.
 3  
  Licensed under the Academic Free License version 3.0
 4  
  */
 5  
 
 6  
 package jaggregate.internal;
 7  
 
 8  
 import static java.lang.String.*;
 9  
 
 10  
 /**
 11  
  * Constants and methods used internally for performing checks on method arguments.
 12  
  *
 13  
  * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
 14  
  * @version $Id: ArgumentChecks.java,v 1.4 2008/10/03 19:01:23 pholser Exp $
 15  
  */
 16  
 public class ArgumentChecks {
 17  
     public static final String DISCRIMINATOR = "discriminator";
 18  
     public static final String OPERATION = "operation";
 19  
     public static final String TRANSFORMER = "transformer";
 20  
     public static final String EMPTY_SEQUENCE = "empty sequence";
 21  
     public static final String REPLACEMENT_SEQUENCE = "replacement sequence";
 22  
     public static final String SEQUENCE = "sequence";
 23  
     public static final String COLLECTION = "collection";
 24  
     public static final String MAPPER = "mapper";
 25  
     public static final String STARTING_INDEX = "starting";
 26  
     public static final String ENDING_INDEX = "ending";
 27  
     public static final String ADDITION_INDEX = "addition";
 28  
     public static final String NEGATIVE_AMOUNT = "illegal negative amount: ";
 29  
     public static final String EXPECTED_SEQUENCE_SIZE =
 30  
         "expecting sequence to have size ";
 31  
     public static final String BUT_WAS = ", was ";
 32  
     public static final String ITERABLE = "iterable";
 33  
     private static final String NULL_FORMAT = "illegal null %1$s";
 34  
 
 35  
     /**
 36  
      * Discourages instantiation.
 37  
      *
 38  
      * @throws UnsupportedOperationException always
 39  
      */
 40  1
     protected ArgumentChecks() {
 41  1
         throw new UnsupportedOperationException();
 42  
     }
 43  
 
 44  
     /**
 45  
      * Raises an exception with the given failure message if the given object is
 46  
      * {@code null}.
 47  
      *
 48  
      * @param target object to check
 49  
      * @param failureMessage message to populate the exception with if {@code target}
 50  
      * is {@code null}
 51  
      * @throws NullPointerException if {@code target} is {@code null}
 52  
      */
 53  
     public static void ensureNotNull( Object target, String failureMessage ) {
 54  39393
         if ( target == null )
 55  288
             throw new NullPointerException( format( NULL_FORMAT, failureMessage ) );
 56  39105
     }
 57  
 }