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 Summary

    Modifier and Type
    Method
    Description
    static <T extends FeatureInput>
    void
    assertDoubleResult(String message, Feature<T> feature, T input, double expectedResult)
    Asserts that a feature calculation results in an expected double value.
    static <T extends FeatureInput>
    void
    assertDoubleResult(String message, Feature<T> feature, T input, Optional<SharedObjects> sharedObjects, double expectedResult)
    Asserts that a feature calculation results in an expected double value, with shared objects.
    static <T extends FeatureInput>
    void
    assertIntResult(String message, Feature<T> feature, T input, int expectedResult)
    Asserts that a feature calculation results in an expected integer value.
    static <T extends FeatureInput>
    void
    assertIntResult(String message, Feature<T> feature, T input, Optional<SharedObjects> sharedObjects, int expectedResult)
    Asserts that a feature calculation results in an expected integer value, with shared objects.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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