Class FeatureTestCalculator
Object
FeatureTestCalculator
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 TypeMethodDescriptionstatic <T extends FeatureInput>
voidassertDoubleResult
(String message, Feature<T> feature, T input, double expectedResult) Asserts that a feature calculation results in an expected double value.static <T extends FeatureInput>
voidassertDoubleResult
(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>
voidassertIntResult
(String message, Feature<T> feature, T input, int expectedResult) Asserts that a feature calculation results in an expected integer value.static <T extends FeatureInput>
voidassertIntResult
(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.
-
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 messagefeature
- the feature to calculateinput
- the input for the feature calculationexpectedResult
- 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 messagefeature
- the feature to calculateinput
- the input for the feature calculationexpectedResult
- 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 messagefeature
- the feature to calculateinput
- the input for the feature calculationsharedObjects
- optional shared objects for the calculationexpectedResult
- 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 messagefeature
- the feature to calculateinput
- the input for the feature calculationsharedObjects
- optional shared objects for the calculationexpectedResult
- the expected result of the calculation- Throws:
FeatureCalculationException
- if the feature calculation fails
-