use of org.kie.kogito.explainability.local.counterfactual.entities.fixed.FixedTextEntity in project kogito-apps by kiegroup.
the class CounterfactualEntityFactoryTest method testTextFactory.
@Test
void testTextFactory() {
final String value = "foo";
final Feature feature = FeatureFactory.newTextFeature("text-feature", value);
CounterfactualEntity counterfactualEntity = CounterfactualEntityFactory.from(feature);
assertTrue(counterfactualEntity instanceof FixedTextEntity);
assertEquals(Type.TEXT, counterfactualEntity.asFeature().getType());
final Feature varyingFeature = FeatureFactory.newTextFeature("text-feature", value, EmptyFeatureDomain.create());
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> {
CounterfactualEntityFactory.from(varyingFeature);
});
assertEquals("Unsupported feature type: text", exception.getMessage());
}
Aggregations