Search in sources :

Example 1 with HitPolicy

use of org.kie.dmn.model.api.HitPolicy in project drools by kiegroup.

the class RecommenderHitPolicyTest method testNoGapsOverlapsDiffValue.

@Test
public void testNoGapsOverlapsDiffValue() {
    List<HitPolicy> wrongHPs = Arrays.asList(HitPolicy.UNIQUE, HitPolicy.ANY, HitPolicy.FIRST);
    for (HitPolicy hp : wrongHPs) {
        List<DMNMessage> validate = getRecommenderHitPolicy4(hp);
        assertTrue(validate.stream().anyMatch(m -> m.getMessageType() == DMNMessageType.DECISION_TABLE_HITPOLICY_RECOMMENDER));
    }
    List<DMNMessage> validate = getRecommenderHitPolicy4(HitPolicy.PRIORITY);
    assertTrue(validate.stream().noneMatch(m -> m.getMessageType() == DMNMessageType.DECISION_TABLE_HITPOLICY_RECOMMENDER));
}
Also used : Arrays(java.util.Arrays) DecisionTable(org.kie.dmn.model.api.DecisionTable) DMNMessage(org.kie.dmn.api.core.DMNMessage) DMNMessageType(org.kie.dmn.api.core.DMNMessageType) VALIDATE_COMPILATION(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_COMPILATION) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Definitions(org.kie.dmn.model.api.Definitions) HitPolicy(org.kie.dmn.model.api.HitPolicy) List(java.util.List) Decision(org.kie.dmn.model.api.Decision) DTAnalysis(org.kie.dmn.validation.dtanalysis.model.DTAnalysis) Matchers.hasSize(org.hamcrest.Matchers.hasSize) ANALYZE_DECISION_TABLE(org.kie.dmn.validation.DMNValidator.Validation.ANALYZE_DECISION_TABLE) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) DMNMessage(org.kie.dmn.api.core.DMNMessage) HitPolicy(org.kie.dmn.model.api.HitPolicy) Test(org.junit.Test)

Example 2 with HitPolicy

use of org.kie.dmn.model.api.HitPolicy in project drools by kiegroup.

the class RecommenderHitPolicyTest method testNoGapsNoOverlaps.

@Test
public void testNoGapsNoOverlaps() {
    List<HitPolicy> wrongHPs = Arrays.asList(HitPolicy.ANY, HitPolicy.PRIORITY, HitPolicy.FIRST);
    for (HitPolicy hp : wrongHPs) {
        List<DMNMessage> validate = getRecommenderHitPolicy2(hp);
        assertTrue(validate.stream().anyMatch(m -> m.getMessageType() == DMNMessageType.DECISION_TABLE_HITPOLICY_RECOMMENDER));
    }
    List<DMNMessage> validate = getRecommenderHitPolicy2(HitPolicy.UNIQUE);
    assertTrue(validate.stream().noneMatch(m -> m.getMessageType() == DMNMessageType.DECISION_TABLE_HITPOLICY_RECOMMENDER));
}
Also used : Arrays(java.util.Arrays) DecisionTable(org.kie.dmn.model.api.DecisionTable) DMNMessage(org.kie.dmn.api.core.DMNMessage) DMNMessageType(org.kie.dmn.api.core.DMNMessageType) VALIDATE_COMPILATION(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_COMPILATION) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Definitions(org.kie.dmn.model.api.Definitions) HitPolicy(org.kie.dmn.model.api.HitPolicy) List(java.util.List) Decision(org.kie.dmn.model.api.Decision) DTAnalysis(org.kie.dmn.validation.dtanalysis.model.DTAnalysis) Matchers.hasSize(org.hamcrest.Matchers.hasSize) ANALYZE_DECISION_TABLE(org.kie.dmn.validation.DMNValidator.Validation.ANALYZE_DECISION_TABLE) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) DMNMessage(org.kie.dmn.api.core.DMNMessage) HitPolicy(org.kie.dmn.model.api.HitPolicy) Test(org.junit.Test)

Example 3 with HitPolicy

use of org.kie.dmn.model.api.HitPolicy in project drools by kiegroup.

the class RecommenderHitPolicyTest method testNoGapsOverlapsSameValue.

@Test
public void testNoGapsOverlapsSameValue() {
    List<HitPolicy> wrongHPs = Arrays.asList(HitPolicy.UNIQUE, HitPolicy.PRIORITY, HitPolicy.FIRST);
    for (HitPolicy hp : wrongHPs) {
        List<DMNMessage> validate = getRecommenderHitPolicy3(hp);
        assertTrue(validate.stream().anyMatch(m -> m.getMessageType() == DMNMessageType.DECISION_TABLE_HITPOLICY_RECOMMENDER));
    }
    List<DMNMessage> validate = getRecommenderHitPolicy3(HitPolicy.ANY);
    assertTrue(validate.stream().noneMatch(m -> m.getMessageType() == DMNMessageType.DECISION_TABLE_HITPOLICY_RECOMMENDER));
}
Also used : Arrays(java.util.Arrays) DecisionTable(org.kie.dmn.model.api.DecisionTable) DMNMessage(org.kie.dmn.api.core.DMNMessage) DMNMessageType(org.kie.dmn.api.core.DMNMessageType) VALIDATE_COMPILATION(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_COMPILATION) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Definitions(org.kie.dmn.model.api.Definitions) HitPolicy(org.kie.dmn.model.api.HitPolicy) List(java.util.List) Decision(org.kie.dmn.model.api.Decision) DTAnalysis(org.kie.dmn.validation.dtanalysis.model.DTAnalysis) Matchers.hasSize(org.hamcrest.Matchers.hasSize) ANALYZE_DECISION_TABLE(org.kie.dmn.validation.DMNValidator.Validation.ANALYZE_DECISION_TABLE) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) DMNMessage(org.kie.dmn.api.core.DMNMessage) HitPolicy(org.kie.dmn.model.api.HitPolicy) Test(org.junit.Test)

Aggregations

Arrays (java.util.Arrays)3 List (java.util.List)3 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)3 Matchers.hasSize (org.hamcrest.Matchers.hasSize)3 Assert.assertTrue (org.junit.Assert.assertTrue)3 Test (org.junit.Test)3 DMNMessage (org.kie.dmn.api.core.DMNMessage)3 DMNMessageType (org.kie.dmn.api.core.DMNMessageType)3 Decision (org.kie.dmn.model.api.Decision)3 DecisionTable (org.kie.dmn.model.api.DecisionTable)3 Definitions (org.kie.dmn.model.api.Definitions)3 HitPolicy (org.kie.dmn.model.api.HitPolicy)3 ANALYZE_DECISION_TABLE (org.kie.dmn.validation.DMNValidator.Validation.ANALYZE_DECISION_TABLE)3 VALIDATE_COMPILATION (org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_COMPILATION)3 DTAnalysis (org.kie.dmn.validation.dtanalysis.model.DTAnalysis)3