Examples of InvalidFunctionUsageException


Examples of com.consol.citrus.exceptions.InvalidFunctionUsageException

    public String execute(List<String> parameterList, TestContext context) {
        int numberLength;
        boolean paddingOn = true;

        if (CollectionUtils.isEmpty(parameterList)) {
            throw new InvalidFunctionUsageException("Function parameters must not be empty");
        }

        if (parameterList.size() > 2) {
            throw new InvalidFunctionUsageException("Too many parameters for function");
        }

        numberLength = Integer.valueOf(parameterList.get(0));
        if (numberLength < 0) {
            throw new InvalidFunctionUsageException("Invalid parameter definition. Number of letters must not be positive non-zero integer value");
        }

        if (parameterList.size() > 1) {
            paddingOn = Boolean.valueOf(parameterList.get(1));
        }
View Full Code Here

Examples of com.consol.citrus.exceptions.InvalidFunctionUsageException

     * @param paddingOn
     * @return
     */
    public static String getRandomNumber(int numberLength, boolean paddingOn) {
        if (numberLength < 1) {
            throw new InvalidFunctionUsageException("numberLength must be greater than 0 - supplied " + numberLength);
        }

        StringBuilder buffer = new StringBuilder();
        for (int i = 0; i < numberLength; i++) {
            buffer.append(generator.nextInt(10));
View Full Code Here

Examples of com.consol.citrus.exceptions.InvalidFunctionUsageException

  /**
   * @see Function#execute(java.util.List, com.consol.citrus.context.TestContext)
   */
  public String execute(List<String> params, TestContext context) {
    if (params.size() != 1) {
      throw new InvalidFunctionUsageException("Expected exactly one argument but got " + params.size());
    }
   
    final String key = params.get(0);
    final String result = map.get(key);
   
    if (result == null) {
      throw new InvalidFunctionUsageException("No mapping found for \"" + key + "\"");
    }
   
    return result;
  }
View Full Code Here

Examples of com.consol.citrus.exceptions.InvalidFunctionUsageException

     * @see com.consol.citrus.functions.Function#execute(java.util.List, com.consol.citrus.context.TestContext)
     * @throws InvalidFunctionUsageException
     */
    public String execute(List<String> parameterList, TestContext context) {
        if (parameterList == null || parameterList.size() < 2) {
            throw new InvalidFunctionUsageException("Function parameters not set correctly");
        }

        String resultString = parameterList.get(0);

        if (parameterList.size()>1) {
View Full Code Here

Examples of com.consol.citrus.exceptions.InvalidFunctionUsageException

     * @see com.consol.citrus.functions.Function#execute(java.util.List, com.consol.citrus.context.TestContext)
     * @throws InvalidFunctionUsageException
     */
    public String execute(List<String> parameterList, TestContext context) {
        if (CollectionUtils.isEmpty(parameterList)) {
            throw new InvalidFunctionUsageException("Function parameters must not be empty");
        }

        String param = parameterList.get(0);
       
        if (param.contains(".")) {
View Full Code Here

Examples of com.consol.citrus.exceptions.InvalidFunctionUsageException

  public String execute(List<String> params, TestContext context) {
    if (values == null) {
      return randomValue(params);
    } else {
      if (!params.isEmpty()) {
        throw new InvalidFunctionUsageException("The enumeration values have already been set");
      }
      return randomValue(values);
    }
  }
View Full Code Here

Examples of com.consol.citrus.exceptions.InvalidFunctionUsageException

   * @return
   * @throws IllegalArgumentException if the values supplied are <code>null</code> or an empty list.
   */
  protected String randomValue(List<String> values) {
    if (values == null || values.isEmpty()) {
      throw new InvalidFunctionUsageException("No values to choose from");
    }
   
    final int idx = random.nextInt(values.size());
   
    return values.get(idx);
View Full Code Here

Examples of com.consol.citrus.exceptions.InvalidFunctionUsageException

    /**
     * {@inheritDoc}
     */
    public String execute(List<String> parameterList, TestContext context) {
        if (CollectionUtils.isEmpty(parameterList) || parameterList.size() != 1) {
            throw new InvalidFunctionUsageException("Invalid function parameter usage - missing parameter value!");
        }

        return CDATA_START + parameterList.get(0) + CDATA_END;
    }
View Full Code Here

Examples of com.consol.citrus.exceptions.InvalidFunctionUsageException

     * @see com.consol.citrus.functions.Function#execute(java.util.List, com.consol.citrus.context.TestContext)
     * @throws InvalidFunctionUsageException
     */
    public String execute(List<String> parameterList, TestContext context) {
        if (CollectionUtils.isEmpty(parameterList)) {
            throw new InvalidFunctionUsageException("Function parameters must not be empty");
        }

        StringBuffer resultString = new StringBuffer();

        for (int i = 0; i < parameterList.size(); i++) {
View Full Code Here

Examples of com.consol.citrus.exceptions.InvalidFunctionUsageException

     * @see com.consol.citrus.functions.Function#execute(java.util.List, com.consol.citrus.context.TestContext)
     * @throws InvalidFunctionUsageException
     */
    public String execute(List<String> parameterList, TestContext context) {
        if (CollectionUtils.isEmpty(parameterList)) {
            throw new InvalidFunctionUsageException("Function parameters must not be empty");
        }

        return String.valueOf((parameterList.get(0)).length());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.