Class FeatureTestCalculator

Object
org.anchoranalysis.test.feature.plugins.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 org.anchoranalysis.feature.input.FeatureInput>
    void
    assertDoubleResult​(String message, org.anchoranalysis.feature.bean.Feature<T> feature, T input, double expectedResult)
    Asserts that a feature calculation results in an expected double value.
    static <T extends org.anchoranalysis.feature.input.FeatureInput>
    void
    assertDoubleResult​(String message, org.anchoranalysis.feature.bean.Feature<T> feature, T input, Optional<org.anchoranalysis.core.identifier.provider.store.SharedObjects> sharedObjects, double expectedResult)
    Asserts that a feature calculation results in an expected double value, with shared objects.
    static <T extends org.anchoranalysis.feature.input.FeatureInput>
    void
    assertIntResult​(String message, org.anchoranalysis.feature.bean.Feature<T> feature, T input, int expectedResult)
    Asserts that a feature calculation results in an expected integer value.
    static <T extends org.anchoranalysis.feature.input.FeatureInput>
    void
    assertIntResult​(String message, org.anchoranalysis.feature.bean.Feature<T> feature, T input, Optional<org.anchoranalysis.core.identifier.provider.store.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 org.anchoranalysis.feature.input.FeatureInput> void assertDoubleResult​(String message, org.anchoranalysis.feature.bean.Feature<T> feature, T input, double expectedResult) throws org.anchoranalysis.feature.calculate.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:
      org.anchoranalysis.feature.calculate.FeatureCalculationException - if the feature calculation fails
    • assertIntResult

      public static <T extends org.anchoranalysis.feature.input.FeatureInput> void assertIntResult​(String message, org.anchoranalysis.feature.bean.Feature<T> feature, T input, int expectedResult) throws org.anchoranalysis.feature.calculate.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:
      org.anchoranalysis.feature.calculate.FeatureCalculationException - if the feature calculation fails
    • assertDoubleResult

      public static <T extends org.anchoranalysis.feature.input.FeatureInput> void assertDoubleResult​(String message, org.anchoranalysis.feature.bean.Feature<T> feature, T input, Optional<org.anchoranalysis.core.identifier.provider.store.SharedObjects> sharedObjects, double expectedResult) throws org.anchoranalysis.feature.calculate.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:
      org.anchoranalysis.feature.calculate.FeatureCalculationException - if the feature calculation fails
    • assertIntResult

      public static <T extends org.anchoranalysis.feature.input.FeatureInput> void assertIntResult​(String message, org.anchoranalysis.feature.bean.Feature<T> feature, T input, Optional<org.anchoranalysis.core.identifier.provider.store.SharedObjects> sharedObjects, int expectedResult) throws org.anchoranalysis.feature.calculate.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:
      org.anchoranalysis.feature.calculate.FeatureCalculationException - if the feature calculation fails