Class FeatureTestCalculatorDuo

Object
FeatureTestCalculatorDuo

public class FeatureTestCalculatorDuo extends Object
Utility class for testing features with both positive and negative cases.

This class provides methods to assert the results of feature calculations for both positive and negative inputs, 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 inputPositive, T inputNegative, double expectedResultPositive, double expectedResultNegative)
    Asserts that a feature calculation results in expected double values for both positive and negative inputs.
    static <T extends FeatureInput>
    void
    assertIntResult(String message, Feature<T> feature, T inputPositive, T inputNegative, int expectedResultPositive, int expectedResultNegative)
    Asserts that a feature calculation results in expected integer values for both positive and negative inputs.

    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 inputPositive, T inputNegative, double expectedResultPositive, double expectedResultNegative) throws FeatureCalculationException
      Asserts that a feature calculation results in expected double values for both positive and negative inputs.
      Type Parameters:
      T - the type of feature input
      Parameters:
      message - the base assertion message
      feature - the feature to calculate
      inputPositive - the positive input for the feature calculation
      inputNegative - the negative input for the feature calculation
      expectedResultPositive - the expected result for the positive input
      expectedResultNegative - the expected result for the negative input
      Throws:
      FeatureCalculationException - if the feature calculation fails
    • assertIntResult

      public static <T extends FeatureInput> void assertIntResult(String message, Feature<T> feature, T inputPositive, T inputNegative, int expectedResultPositive, int expectedResultNegative) throws FeatureCalculationException
      Asserts that a feature calculation results in expected integer values for both positive and negative inputs.
      Type Parameters:
      T - the type of feature input
      Parameters:
      message - the base assertion message
      feature - the feature to calculate
      inputPositive - the positive input for the feature calculation
      inputNegative - the negative input for the feature calculation
      expectedResultPositive - the expected result for the positive input
      expectedResultNegative - the expected result for the negative input
      Throws:
      FeatureCalculationException - if the feature calculation fails