Class AdvancedRandomNumberFunction

java.lang.Object
org.citrusframework.functions.core.AdvancedRandomNumberFunction
All Implemented Interfaces:
org.citrusframework.functions.Function

public class AdvancedRandomNumberFunction extends Object implements org.citrusframework.functions.Function
A function for generating random double values with specified decimal places and range. This function includes options to specify the number of decimal places, minimum and maximum values, and whether to include or exclude the minimum and maximum values.

Parameters:

  1. Decimal places: The number of decimal places in the generated random number (optional, default: 0). Note that definition of 0 results in an integer.
  2. Min value: The minimum value for the generated random number (optional, default: DEFAULT_MIN_VALUE).
  3. Max value: The maximum value for the generated random number (optional, default: DEFAULT_MAX_VALUE).
  4. Exclude min: Whether to exclude the minimum value (optional, default: false).
  5. Exclude max: Whether to exclude the maximum value (optional, default: false).
  6. Multiple of: The generated number will be a multiple of this value (optional).
  7. Format pattern: The format pattern for the returned string (optional, default: null)</li

  • Constructor Details

    • AdvancedRandomNumberFunction

      public AdvancedRandomNumberFunction()
  • Method Details

    • execute

      public String execute(List<String> parameterList, org.citrusframework.context.TestContext context)
      Specified by:
      execute in interface org.citrusframework.functions.Function
    • formatRandomNumber

      public static String formatRandomNumber(BigDecimal randomValue, int decimalPlaces, String formatPattern)