Coverage Report - com.lexicalscope.jewel.cli.ArgumentValidationExceptionFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
ArgumentValidationExceptionFactory
62%
5/8
N/A
1
 
 1  
 package com.lexicalscope.jewel.cli;
 2  
 
 3  
 import java.util.List;
 4  
 
 5  
 import com.lexicalscope.jewel.cli.specification.OptionSpecification;
 6  
 
 7  
 /*
 8  
  * Copyright 2011 Tim Wood
 9  
  *
 10  
  * Licensed under the Apache License, Version 2.0 (the "License");
 11  
  * you may not use this file except in compliance with the License.
 12  
  * You may obtain a copy of the License at
 13  
  *
 14  
  * http://www.apache.org/licenses/LICENSE-2.0
 15  
  *
 16  
  * Unless required by applicable law or agreed to in writing, software
 17  
  * distributed under the License is distributed on an "AS IS" BASIS,
 18  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 19  
  * See the License for the specific language governing permissions and
 20  
  * limitations under the License.
 21  
  */
 22  
 
 23  0
 class ArgumentValidationExceptionFactory {
 24  
     static ValidationFailureImpl createUnexpectedOptionError(final String name)
 25  
     {
 26  8
         return new ValidationFailureUnexpectedOption(new UnexpectedOptionSpecification(name));
 27  
     }
 28  
 
 29  
     static ValidationFailureImpl createUnexpectedValueError(final OptionSpecification optionSpecification, final List<String> values)
 30  
     {
 31  0
         return new ValidationFailureUnexpectedValue(optionSpecification, values);
 32  
     }
 33  
 
 34  
     static ValidationFailureImpl createUnexpectedTrailingValues(final List<String> unparsedArguments) {
 35  2
         return new ValidationFailureUnexpectedTrailingValue(unparsedArguments);
 36  
     }
 37  
 
 38  
     static ValidationFailureImpl createMissingOptionError(final OptionSpecification optionSpecification)
 39  
     {
 40  14
         return new ValidationFailureMissingOption(optionSpecification);
 41  
     }
 42  
 
 43  
     static ValidationFailureImpl createInvalidValueForType(
 44  
             final OptionSpecification optionSpecification,
 45  
             final String message)
 46  
     {
 47  10
         return new ValidationFailureInvalidValueForType(optionSpecification, message);
 48  
     }
 49  
 
 50  
     static ValidationFailureImpl createUnableToConstructType(
 51  
             final OptionSpecification optionSpecification,
 52  
             final String message)
 53  
     {
 54  0
         return new ValidationFailureUnableToConstructType(optionSpecification, message);
 55  
     }
 56  
 
 57  
     static ValidationFailureImpl createPatternMismatch(
 58  
             final OptionSpecification optionSpecification,
 59  
             final String message)
 60  
     {
 61  6
         return new ValidationFailurePatternMismatch(optionSpecification, message);
 62  
     }
 63  
 }