use of org.kie.kogito.explainability.local.counterfactual.entities.TimeEntity in project kogito-apps by kiegroup.
the class CounterfactualEntityFactoryTest method testTimeFactory.
@Test
void testTimeFactory() {
final LocalTime value = LocalTime.now();
Feature feature = FeatureFactory.newTimeFeature("time-feature", value);
CounterfactualEntity counterfactualEntity = CounterfactualEntityFactory.from(feature);
assertTrue(counterfactualEntity instanceof FixedTimeEntity);
assertEquals(Type.TIME, counterfactualEntity.asFeature().getType());
FeatureDomain domain = TimeFeatureDomain.create(value.minusHours(10), value.plusHours(10));
feature = FeatureFactory.newTimeFeature("time-feature", value, domain);
counterfactualEntity = CounterfactualEntityFactory.from(feature);
assertTrue(counterfactualEntity instanceof TimeEntity);
assertEquals(Type.TIME, counterfactualEntity.asFeature().getType());
assertEquals(value, ((TimeEntity) counterfactualEntity).getProposedValue());
}
Aggregations