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>
voidassertDoubleResult(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>
voidassertDoubleResult(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>
voidassertIntResult(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>
voidassertIntResult(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.
-
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.FeatureCalculationExceptionAsserts that a feature calculation results in an expected double value.- Type Parameters:
T- the type of feature input- Parameters:
message- the assertion messagefeature- the feature to calculateinput- the input for the feature calculationexpectedResult- 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.FeatureCalculationExceptionAsserts that a feature calculation results in an expected integer value.- Type Parameters:
T- the type of feature input- Parameters:
message- the assertion messagefeature- the feature to calculateinput- the input for the feature calculationexpectedResult- 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.FeatureCalculationExceptionAsserts 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 messagefeature- the feature to calculateinput- the input for the feature calculationsharedObjects- optional shared objects for the calculationexpectedResult- 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.FeatureCalculationExceptionAsserts 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 messagefeature- the feature to calculateinput- the input for the feature calculationsharedObjects- optional shared objects for the calculationexpectedResult- the expected result of the calculation- Throws:
org.anchoranalysis.feature.calculate.FeatureCalculationException- if the feature calculation fails
-