use of org.kie.kogito.explainability.local.counterfactual.entities.ObjectEntity in project kogito-apps by kiegroup.
the class CounterfactualEntityFactoryTest method testObjectFactory.
@Test
void testObjectFactory() {
final URI value = URI.create("./");
Feature feature = FeatureFactory.newObjectFeature("f", value);
CounterfactualEntity counterfactualEntity = CounterfactualEntityFactory.from(feature);
assertTrue(counterfactualEntity instanceof FixedObjectEntity);
assertEquals(Type.UNDEFINED, counterfactualEntity.asFeature().getType());
FeatureDomain domain = ObjectFeatureDomain.create("test", 45L);
feature = FeatureFactory.newObjectFeature("uri-feature", value, domain);
counterfactualEntity = CounterfactualEntityFactory.from(feature);
assertTrue(counterfactualEntity instanceof ObjectEntity);
assertEquals(value, counterfactualEntity.asFeature().getValue().getUnderlyingObject());
domain = ObjectFeatureDomain.create(List.of("test", 45L));
feature = FeatureFactory.newObjectFeature("uri-feature", value, domain);
counterfactualEntity = CounterfactualEntityFactory.from(feature);
assertTrue(counterfactualEntity instanceof ObjectEntity);
assertEquals(value, counterfactualEntity.asFeature().getValue().getUnderlyingObject());
domain = ObjectFeatureDomain.create(Set.of("test", 45L));
feature = FeatureFactory.newObjectFeature("uri-feature", value, domain);
counterfactualEntity = CounterfactualEntityFactory.from(feature);
assertTrue(counterfactualEntity instanceof ObjectEntity);
assertEquals(value, counterfactualEntity.asFeature().getValue().getUnderlyingObject());
}
Aggregations