@Test public void descriptorsAreParsedAsExpected() { assertThat(ArgumentsDescriptor.createDescriptor()).isEqualTo(new ArgumentsDescriptor(new ArrayList<>(), -1)); assertThat(ArgumentsDescriptor.createDescriptor("x")).isEqualTo( new ArgumentsDescriptor(newArrayList(new Argument(ArgumentType.REQUIRED, "x", null, null)), -1)); assertThat(ArgumentsDescriptor.createDescriptor("x: int")).isEqualTo( new ArgumentsDescriptor(newArrayList(new Argument(ArgumentType.REQUIRED, "x", "int", null)), -1)); assertThat(ArgumentsDescriptor.createDescriptor("x=1")).isEqualTo( new ArgumentsDescriptor(newArrayList(new Argument(ArgumentType.DEFAULT, "x", null, "1")), -1)); assertThat(ArgumentsDescriptor.createDescriptor("x: int=1")).isEqualTo( new ArgumentsDescriptor(newArrayList(new Argument(ArgumentType.DEFAULT, "x", "int", "1")), -1)); assertThat(ArgumentsDescriptor.createDescriptor("x: annotation=1=2:3=4")).isEqualTo( new ArgumentsDescriptor(newArrayList(new Argument(ArgumentType.DEFAULT, "x", "annotation", "1=2:3=4")), -1)); assertThat(ArgumentsDescriptor.createDescriptor("*v")).isEqualTo( new ArgumentsDescriptor(newArrayList(new Argument(ArgumentType.VARARG, "v", null, null)), -1)); assertThat(ArgumentsDescriptor.createDescriptor("**kw")).isEqualTo( new ArgumentsDescriptor(newArrayList(new Argument(ArgumentType.KWARG, "kw", null, null)), -1)); assertThat(ArgumentsDescriptor.createDescriptor("x", "y=2", "*v", "z=3", "w", "**kw")).isEqualTo( new ArgumentsDescriptor(newArrayList( new Argument(ArgumentType.REQUIRED, "x", null, null), new Argument(ArgumentType.DEFAULT, "y", null, "2"), new Argument(ArgumentType.VARARG, "v", null, null), new Argument(ArgumentType.KEYWORD_ONLY, "z", null, "3"), new Argument(ArgumentType.KEYWORD_ONLY, "w", null, null), new Argument(ArgumentType.KWARG, "kw", null, null)), -1)); assertThat(ArgumentsDescriptor.createDescriptor("x", "y=2", "*", "z=3", "w", "**kw")).isEqualTo( new ArgumentsDescriptor(newArrayList(new Argument(ArgumentType.REQUIRED, "x", null, null), new Argument(ArgumentType.DEFAULT, "y", null, "2"), new Argument(ArgumentType.KEYWORD_ONLY, "z", null, "3"), new Argument(ArgumentType.KEYWORD_ONLY, "w", null, null), new Argument(ArgumentType.KWARG, "kw", null, null)), 2)); }
public static ArgumentsDescriptor createDescriptor(final String... args) { return createDescriptor(newArrayList(args)); }
ArgumentsDescriptor implements Iterable<Argument> { public static ArgumentsDescriptor createDescriptor(final String... args) { return createDescriptor(newArrayList(args)); } }
ArgumentsDescriptor implements Iterable<Argument> { public static ArgumentsDescriptor createDescriptor(final String... args) { return createDescriptor(newArrayList(args)); } @VisibleForTesting  ArgumentsDescriptor(final List<Argument> args, final int lastPositional); }
ArgumentsDescriptor implements Iterable<Argument> { public static ArgumentsDescriptor createDescriptor(final String... args) { return createDescriptor(newArrayList(args)); } @VisibleForTesting  ArgumentsDescriptor(final List<Argument> args, final int lastPositional); static ArgumentsDescriptor createDescriptor(final String... args); static ArgumentsDescriptor createDescriptor(final List<String> args); @Override Iterator<Argument> iterator(); Stream<Argument> stream(); int size(); Argument get(final int index); void validate(final RobotVersion robotVersion); Range<Integer> getPossibleNumberOfArgumentsPassedByPosition(); Range<Integer> getPossibleNumberOfArgumentsPassedByName(); Range<Integer> getPossibleNumberOfNonKwargsArguments(); Range<Integer> getPossibleNumberOfArguments(); boolean hasFixedNumberOfArguments(); boolean supportsVarargs(); boolean supportsKeywordOnlyArguments(); boolean supportsKwargs(); List<Argument> getRequiredArguments(); List<Argument> getDefaultArguments(); Optional<Argument> getVarargArgument(); List<Argument> getKeywordOnlyRequiredArguments(); List<Argument> getKeywordOnlyDefaultArguments(); Optional<Argument> getKwargArgument(); String getDescription(); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString(); }
ArgumentsDescriptor implements Iterable<Argument> { public static ArgumentsDescriptor createDescriptor(final String... args) { return createDescriptor(newArrayList(args)); } @VisibleForTesting  ArgumentsDescriptor(final List<Argument> args, final int lastPositional); static ArgumentsDescriptor createDescriptor(final String... args); static ArgumentsDescriptor createDescriptor(final List<String> args); @Override Iterator<Argument> iterator(); Stream<Argument> stream(); int size(); Argument get(final int index); void validate(final RobotVersion robotVersion); Range<Integer> getPossibleNumberOfArgumentsPassedByPosition(); Range<Integer> getPossibleNumberOfArgumentsPassedByName(); Range<Integer> getPossibleNumberOfNonKwargsArguments(); Range<Integer> getPossibleNumberOfArguments(); boolean hasFixedNumberOfArguments(); boolean supportsVarargs(); boolean supportsKeywordOnlyArguments(); boolean supportsKwargs(); List<Argument> getRequiredArguments(); List<Argument> getDefaultArguments(); Optional<Argument> getVarargArgument(); List<Argument> getKeywordOnlyRequiredArguments(); List<Argument> getKeywordOnlyDefaultArguments(); Optional<Argument> getKwargArgument(); String getDescription(); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString();  }