Class FeatureTestCalculator

Object
FeatureTestCalculator

public class FeatureTestCalculator extends Object
Utility class for testing feature calculations in a controlled environment.

This class provides methods to assert the results of feature calculations against expected values, supporting both double and integer results.

  • Method Details

    • assertDoubleResult

      public static <T extends FeatureInput> void assertDoubleResult(String message, Feature<T> feature, T input, double expectedResult) throws FeatureCalculationException
      Asserts that a feature calculation results in an expected double value.
      Type Parameters:
      T - the type of feature input
      Parameters:
      message - the assertion message
      feature - the feature to calculate
      input - the input for the feature calculation
      expectedResult - the expected result of the calculation
      Throws:
      FeatureCalculationException - if the feature calculation fails
    • assertIntResult

      public static <T extends FeatureInput> void assertIntResult(String message, Feature<T> feature, T input, int expectedResult) throws FeatureCalculationException
      Asserts that a feature calculation results in an expected integer value.
      Type Parameters:
      T - the type of feature input
      Parameters:
      message - the assertion message
      feature - the feature to calculate
      input - the input for the feature calculation
      expectedResult - the expected result of the calculation
      Throws:
      FeatureCalculationException - if the feature calculation fails
    • assertDoubleResult

      public static <T extends FeatureInput> void assertDoubleResult(String message, Feature<T> feature, T input, Optional<SharedObjects> sharedObjects, double expectedResult) throws FeatureCalculationException
      Asserts that a feature calculation results in an expected double value, with shared objects.
      Type Parameters:
      T - the type of feature input
      Parameters:
      message - the assertion message
      feature - the feature to calculate
      input - the input for the feature calculation
      sharedObjects - optional shared objects for the calculation
      expectedResult - the expected result of the calculation
      Throws:
      FeatureCalculationException - if the feature calculation fails
    • assertIntResult

      public static <T extends FeatureInput> void assertIntResult(String message, Feature<T> feature, T input, Optional<SharedObjects> sharedObjects, int expectedResult) throws FeatureCalculationException
      Asserts that a feature calculation results in an expected integer value, with shared objects.
      Type Parameters:
      T - the type of feature input
      Parameters:
      message - the assertion message
      feature - the feature to calculate
      input - the input for the feature calculation
      sharedObjects - optional shared objects for the calculation
      expectedResult - the expected result of the calculation
      Throws:
      FeatureCalculationException - if the feature calculation fails