Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test code coverage #571

Closed
remkop opened this issue Dec 19, 2018 · 0 comments
Closed

Improve test code coverage #571

remkop opened this issue Dec 19, 2018 · 0 comments

Comments

@remkop
Copy link
Owner

remkop commented Dec 19, 2018

CommandLine

  • isUsageHelpRequested (before parsing anything vs after parsing something)
  • isVersionHelpRequested (before parsing anything vs after parsing something)
  • getEndOfOptionsDelimiter (subcommands)
  • setEndOfOptionsDelimiter (subcommands)
  • getUnmatchedArguments (before parsing anything vs after parsing something)
  • getParseResult (before parsing anything vs after parsing something)
  • AbstractHandler.returnResultOrExit (when hasExitCode() == true)
  • printHelpIfRequested(List, PrintStream, Ansi)
  • printHelpIfRequested(ParseResult)
  • printHelpIfRequested(List, PrintStream, PrintStream, ColorScheme), where CommandSpec.helpCommand() == true but does not implement IHelpCommandInitializable
  • execute, where Runnable throws ExecutionException
  • execute, where Callable throws ExecutionException
  • execute, where Callable throws ParameterException
  • execute, where command method is static
  • execute, where command method is not a subcommand and is in class that only has non-default constructors
  • execute, where invoking the command method throws ExecutionException
  • execute, where invoking the command method throws other Exception
  • execute, where preparing to invoke the command method throws other Exception (private constructor, constructor throws exception?)
  • RunAll.self() (why are RunFirst.self() and RunLast.self() tested but RunAll.self() is not?)
  • parseWithHandlers(IParseResultHandler2, IExceptionHandler2, String...) when ExecutionException is thrown by IParseResultHandler2
  • private StringBuilder usage(StringBuilder, Help) where renderer != null
  • static call(Callable, PrintStream, PrintStream, Ansi, String...) where results == null
  • static call(Class, IFactory, PrintStream, PrintStream, Ansi, String...) where results == null
  • static invoke(String, Class, PrintStream, Ansi, String...)
  • static invoke(String, Class, PrintStream, PrintStream, Ansi, String...) where candidates size != 1
  • NoCompletionCandidates.iterator() - should throw UnsupportedOperationEx
  • NoDefaultProvider.defaultValue()
  • constructor Range(int, int, boolean, boolean, String) - where min < 0, max < 0
  • Range.optionArity - where member.isAnnotationPresent(Option) == false
  • Range.parameterArity - where member.isMethodParameter() == false
  • Range.parameterIndex(Field)
  • Range.defaultArity(Field)
  • Range.defaultArity(Class)
  • Range.parameterArity(Range, Range) - where arity.isVariable == true and arity.isVariable == false
  • Range.max(int)
  • Range.equals - where object is not a Range, where field values differ/same
  • CommandSpec.parser(ParserSpec)
  • CommandSpec.usageMessage(UsageMessageSpec)
  • CommandSpec.addSubcommand - where previous != null && previous != subcommandLine, or different subcommand has same alias
  • CommandSpec.initResourceBundle - where current resourceBundle != null
  • CommandSpec.addMethodSubcommands()
  • CommandSpec.addMethodSubcommands(IFactory) - where userObject instance of Method
  • CommandSpec.addOption - where existing == null || existing.equals(option) - add same option twice : no DuplicateOptionException
  • CommandSpec.aliases - where aliases == null
  • CommandSpec.mixinStandardHelpOptions - where name.length==2 && !name.startsWith("-") //?
  • CommandSpec.initHelpCommand - if !initializable
  • CommandSpec.initVersionProvider(IVersionProvider) - if this.versionProvider != null
  • CommandSpec.initVersionProvider(Class, IFactory)
  • CommandSpec.initDefaultValueProvider(IDefaultValueProvider) - if this.defaultValueProvider != null
  • CommandSpec.findOption(char, Iterable) -
  • CommandSpec.resemblesOption - with null Tracer
  • UsageMessageSpec.customSynopsis setter
  • UsageMessageSpec.hidden setter
  • UsageMessageSpec.commandListHeading setter
  • UsageMessageSpec.initFromMixin(UsageMessageSpec, CommandSpec) - with non-default hidden
  • UsageMessageSpec.initFrom(UsageMessageSpec, CommandSpec)
  • ParserSpec.initFrom(ParserSpec)
  • ArgSpec constructor - where builder.auxTypes is empty array
  • ArgSpec.renderedDescription() - where desc.length ==0 (empty array)
  • ArgSpec.getter()
  • ArgSpec.getValue - where getter throws PicocliEx or other Exception
  • ArgSpec.setValue - where setter throws PicocliEx or other Exception
  • ArgSpec.setValue(T, CommandLine) - where setter throws other Exception
  • ArgSpec.debug where level is (not?) DEBUG
  • ArgSpec.splitRespectingQuotedStrings - with embedded '' backslash; with unbalanced quotes; where !quotedValues.isEmpty
  • ArgSpec.restoreQuotedStrings - with embedded '' backslash
  • ArgSpec.equalsImpl - where other==this; arit, hideParamSyntax, required, splitRegex, description, descriptionKey, auxTypes
  • ArgSpec.Builder.descriptionKey() getter
  • ArgSpec.Builder.hideParamSyntax() getter
  • ArgSpec.Builder.hasInitialValue() getter
  • ArgSpec.Builder.completionCandidates() getter
  • OptionSpec constructor - where names.length==0 || names.contains("")
  • OptionSpec.internalShowDefaultValue(boolean) - all combinations
  • OptionSpec.equals - equals names, equals super
  • PositionalParamSpec.description - where newValue == null or not null
  • PositionalParamSpec.equals - where capacity, index differ/same
  • PositionalParamSpec where both getter and setter are null
  • MethodParam.getDeclaringExecutable
  • MethodParam.isAccessible
  • TypedMember constructor (5990) where
    [ ] - combinations: params.length==0 && returnType != Void.Type && returnType != Void.class
    [ ] - both getter and setter (cannot be true, fix constructor)
    [ ] - isGetter but not proxy
  • TypedMember.initializeInitialValue - Exception thrown from setter
  • TypedMember.propertyName - where name.length > 3 && starts with "get" or "set"
  • TypedMember.decapitalize - where name == null or name == ""
  • Messages.copy - where original == null/not null
  • Messages.empty - where messages.rb == null
  • Messages.getString - where rb == null or this.keys is empty
  • Messages.getStringArray - where rb == null or this.keys is empty
  • Messages.commandSpec
  • CommandReflection.extractCommandSpec - where object is a class, an InitializationException occurred, but class is not an interface
  • CommandReflection.initSubcommands - where NoSuchMethodException occurred
  • CommandReflection.subcommandName - where @command(name = "")
  • CommandReflection.validateUnmatched - where only unmatched
  • CommandReflection.validateArgSpecField - where both mixin and @option; where final non-primitive: no InitializationException
  • CommandReflection.validateInjectSpec - where @Inject && @Option/@parameters; where @Inject and @unmatched; where @Inject and @mixin
  • CommandReflection.buildMixinForField - where factory throws Exception
  • CommandReflection.buildUnmatchedForField - where List; where member.getter().get() returns null
  • ArgsReflection
  • ArgsReflection.inferLabel - where types.length == 1
  • ArgsReflection.inferTypes - where paramTypes[i] not instanceof WildcardType
  • FieldBinding.get - where field.get throws Exception (inaccessible?)
  • MethodBinding.get - where method.invoke throws Exception (inaccessible?)
  • ParseResult.nowProcessing - where nowProcessing == null
  • ParseResult.addUnmatched(String)
  • ParseResult.addUnmatched(Stack)
  • ParseResult.matchedPositional - where matchedPositionalParams.size <= position
  • ParseResult.matchedPositionals
  • Interpreter.parse - with all combinations of ANSI, TTY, XTerm, etc?
  • Interpreter.addOrExpand - where config.expandAtFiles == false; where traceLevel == INFO
  • Interpreter.expandArgumentFile - where traceLevel == INFO
  • Interpreter.expandValidArgumentFile - where line starts with #; where Exception occurred; where traceLevel == INFO
  • Interpreter.useSimplifiedAtFiles - where system property "picocli.useSimplifiedAtFiles" is empty string
  • Interpreter.parse - where Exception caught and ParserSpec.collectErrors == true
  • Interpreter.applyDefaultValues - where Tracer is DEBUG
  • Interpreter.processArguments
    [ ] - where option=value and optionsMap.contains(key) and optionsMap.contains(value) and Tracer is DEBUG
    [ ] - where Tracer is DEBUG
  • Interpreter.handleUnmatchedArgument - where stack is empty
  • Interpreter.processPositionalParameter
    [ ] - where Tracer is DEBUG
    [ ] - where assertNoMissingParameters returned false
    [ ] - where args.isEmpty when done
  • Interpreter.processClusteredShortOptions
    [ ] - where cluster.length == 0 (NOTE: the internal cluster.length > 0 condition before taking a substring is redundant)
    [ ] - where cluster.length == 0
    [ ] - where arg.endsWith(cluster) is false
  • Interpreter.applyOption (7393)
    [ ] - where args stack is empty
    [ ] - where Tracer DEBUG
    [ ] - where workingStack not empty after popping one element (NOTE may not be reproducible)
  • Interpreter.applyValueToSingleValuedField (7434)
    [ ] - where arity.max > 0 and value.equals("abc")
    [ ] - where arity.max > 0 and value.equals("true") and lookBehind.isAttached
    [ ] - where non-boolean option with omitted optional value, followed by another option
    [ ] - where this method is invoked with an empty stack
    [ ] - where a initialized=null Set is passed as parameter
  • Interpreter.applyValueToMapField (7508) - where auxTypes.length < 2
  • Interpreter.consumeMapArguments (7548)
    [ ] - where an empty args stack is passed in
    [ ] - where option arity is 1..5 and args.length < 5
  • Interpreter.canConsumeOneMapArgument (7600)
  • Interpreter.splitKeyValue where option value is not in KEY=VALUE format
  • Interpreter.applyValuesToArrayField - where String values are converted to Collection objects - this gets flattened
  • Interpreter.applyValuesToCollectionField - where String values are converted to Collection objects - this gets flattened
  • Interpreter.consumeArguments - where type is Boolean and arity > 1
  • Interpreter.consumedCountMap - where ParserSpec.splitFirst == true
  • Interpreter.varargCanConsumeNextValue
    [ ] - where endOfOptions && arg.isPositional
    [ ] - where nextValue is not a command and not an option
  • Interpreter.is (7865) - where value == true and Tracer INFO
  • Interpreter.createCollection - where collectionClass is a concrete Collection (not an interface)
  • Interpreter.assertNoMissingParameters
    [ ] - where arity.min > available, arity.min==1, argSpec.isOption and don't throw (ParserSpec.collectErrors is true)
    [ ] - where arity.min > available, arity.min==1, and count<=1 || arity.min - available <= 1
  • Interpreter.unquote
    [ ] - where value is null
    [ ] - where value.length <= 1
  • Interpreter.readPassword (7969) NOTE can only be tested on Java 6+
    [ ] - where echoInput is true
    [ ] - where InputStream.readLine throws IOException
  • BuiltIn.ISO8601TimeConverter
    [ ] - where value.length > 12
    [ ] - where value is "12X09" throws ParseException
  • BuiltIn.ISO8601TimeConverter.createTime with invalid epochMillis should throw TypeConversionException
  • BuiltIn.ISO8601TimeConverter.registerIfAvailable - where registry is null
  • BuiltIn.ByteOrderConverter with "BIG_ENDIAN" value
  • BuiltIn.NetworkInterfaceConverter where NetworkInterface.getByName throws exception (cannot list interfaces) TODO requires mocking?
  • BuiltIn.registerIfAvailable - with invalid factory class name
  • BuiltIn.ReflectionConverter.convert (8217) NOTE may not be able to reproduce Exception
  • AutoHelpMixin.run - where run is called before init
  • Help.addAllSubcommands with null map
  • Help.addSubcommand
  • Help.synopsis() getter
  • Help.abbreviatedSynopsis - where positionalParam.isHidden is true
  • Help.detailedSynopsis(Comparator, boolean)
  • Help.createDetailedSynopsisOptionsText where shortestName==2 && does not start with "-" or where shortestName != 2 && shortestName.startsWith("-")
  • Help.heading(Ansi, int, String, Object...) - where result.endsWith(lineSep)
  • Help.countTrailingSpaces - where str is null
  • Help.join - where values is null
  • Help.format - where formatString == ""
  • Help.join(String[], int, int, String) - where names == null (8944)
  • Help.createDefaultLayout
  • Help.createMinimalParamLabelRenderer().separator()
  • Help.MinimalOptionRenderer.render - where option.description.length == 0
  • Help.MinimalParameterRenderer.render - where option.description.length == 0
  • Help.DefaultParameterRenderer.createDescriptionFirstLines - where description is an empty array or an array of one empty string
  • Help.Layout(ColorScheme, int) constructor (9348)
  • Help.SortByShortestOptionNameAlphabetically - where o1 is null or o2 is null
  • Help.TextTable(Ansi, Column[]) constructor - where columns.length == 0 (should throw IllegalArgEx)
  • Help.TextTable.cellAt
  • Help.TextTable.addRowValues - where a value in the array is null
  • Help.TextTable.putValue - where row > rowCount() - 1
  • Help.TextTable.putValue - where value is null or value is empty String
  • Help.TextTable.putValue - are all column.overFlow values covered in the switch? - IllegalStateException never thrown (9700)
  • Help.ColorScheme empty constructor (9790)
  • Help.Ansi.isXterm - where System.getenv("TERM") starts with "xterm"
  • Help.Ansi.hasOsType - where System.getenv("OSTYPE") is not null
  • Help.Ansi.calcTTY
  • Help.Ansi.ansiPossible
  • Help.Ansi.isJansiConsoleInstalled
  • Help.Style.parse - where missing closing bracket in "fg(white" or "bg(white"
  • Help.Text.splitLines where ... (10174)
  • Help.Text.append(String)
  • Help.Text.append(Text)
  • Help.Text.hashCode
  • Assert.equals - where o1 is null or o2 is null
  • Tracer.isWarn
  • CosineSimilarity.countNgramFrequency - where ... (10368)
  • ParameterException(CommandLine, String, Throwable, ArgSpec, String) constructor where argSpec and value are both null
  • ParameterException(CommandLine, String, ArgSpec, String) constructor where argSpec and value are both null
  • UnmatchedArgumentException(CommandLine,Stack) constructor
  • UnmatchedArgumentException.getUnmatched()
  • UnmatchedArgumentException.getSuggestions() - where unmatched is null or empty
  • UnmatchedArgumentException.isunknownOption - where unmatch == null or unmatch is empty

AutoComplete

  • 94 App.run - where commandName is not null
  • 101 App.run - where autoCompleteScript is null
  • 144 Bashify.bashify - where c is '_'
  • 147 Bashify.bashify - where c is space
  • 154 EnumNameFunction - never called - TODO remove completely
  • 167 BooleanArgFilter - Boolean / boolean
  • 172 EnumArgFilter - never called - TODO remove completely
  • 188 Predicate.and - never called - TODO remove completely
  • 209 CommandDescriptor.equals - with unrelated object, same/different functionName/commandName
  • 533 generateOptionsCases - can this be simplified? enumOptions only contains options with completions
  • 538 generateOptionsCases - where option type is file or option type is java.nio.file.Path (may not be possible when only requiring Java 5 in this module)
  • 568 complete - where spec, args or candidates is null
  • 577 complete - where argIndex < 0 or >= args.length
  • 578 complete - where positionInArg < 0 or >= args[argIndex].length()
  • 592 complete - where subcommand found
  • 600 complete - where subcommand not found and found option with attached separator =
  • 609 complete - where did not find subcommand, option or positional
  • 620 findCompletionStartPoint - where option has arity=2
  • 640 findCommandFor(ArgSpec)
  • 654 findCommandFor(PositionalParamSpec) - where the specified Positional is part of the specified CommandSpec
  • 663 isPicocliModelObject
  • 677 addCandidatesForArgsFollowing(Object) - where obj is null
  • 677 addCandidatesForArgsFollowing(Object) - where obj is a PositionalParamSpec
  • 677 addCandidatesForArgsFollowing(Object) - where obj is neither an OptionSpec nor a PositionalParamSpec
  • 687 addCandidatesForArgsFollowing(CommandSpec) - where command is null
  • 687 addCandidatesForArgsFollowing(OptionSpec) - where OptionSpec is null
  • 687 addCandidatesForArgsFollowing(PositionalParamSpec) - where PositionalParamSpec is null
remkop added a commit that referenced this issue Dec 19, 2018
remkop added a commit that referenced this issue Dec 20, 2018
remkop added a commit that referenced this issue Dec 20, 2018
remkop added a commit that referenced this issue Dec 20, 2018
remkop added a commit that referenced this issue Dec 20, 2018
remkop added a commit that referenced this issue Dec 20, 2018
remkop added a commit that referenced this issue Dec 20, 2018
remkop added a commit that referenced this issue Dec 20, 2018
remkop added a commit that referenced this issue Dec 20, 2018
remkop added a commit that referenced this issue Dec 20, 2018
remkop added a commit that referenced this issue Dec 20, 2018
remkop added a commit that referenced this issue Dec 21, 2018
remkop added a commit that referenced this issue Dec 21, 2018
remkop added a commit that referenced this issue Dec 21, 2018
remkop added a commit that referenced this issue Dec 21, 2018
remkop added a commit that referenced this issue Dec 21, 2018
remkop added a commit that referenced this issue Dec 21, 2018
remkop added a commit that referenced this issue Dec 21, 2018
remkop added a commit that referenced this issue Dec 21, 2018
remkop added a commit that referenced this issue Dec 21, 2018
remkop added a commit that referenced this issue Dec 21, 2018
@remkop remkop added this to the 3.9 milestone Dec 21, 2018
remkop added a commit that referenced this issue Dec 22, 2018
remkop added a commit that referenced this issue Dec 22, 2018
remkop added a commit that referenced this issue Dec 22, 2018
remkop added a commit that referenced this issue Dec 22, 2018
remkop added a commit that referenced this issue Jan 2, 2019
remkop added a commit that referenced this issue Jan 2, 2019
remkop added a commit that referenced this issue Jan 2, 2019
remkop added a commit that referenced this issue Jan 2, 2019
remkop added a commit that referenced this issue Jan 3, 2019
@remkop remkop closed this as completed in eca9e6c Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant