use of org.kie.dmn.validation.dtanalysis.model.DTAnalysis in project drools by kiegroup.
the class SomeProblemTest method test.
@Test
public void test() {
List<DMNMessage> validate = validator.validate(getReader("SomeProblem.dmn"), ANALYZE_DECISION_TABLE);
DTAnalysis analysis1 = getAnalysis(validate, "_a36e37f8-aae0-4118-8267-cbb37c7955cb");
assertThat(analysis1.isError(), is(false));
assertThat(analysis1.getGaps(), hasSize(0));
assertThat(analysis1.getOverlaps(), hasSize(0));
DTAnalysis analysis2 = getAnalysis(validate, "_2aea80b4-19fa-4831-8829-4db925a128aa");
assertThat(analysis2.isError(), is(true));
}
use of org.kie.dmn.validation.dtanalysis.model.DTAnalysis in project drools by kiegroup.
the class MaskTest method test_MaskBasic.
@Test
public void test_MaskBasic() {
List<DMNMessage> validate = validator.validate(getReader("MaskBasic.dmn"), VALIDATE_COMPILATION, ANALYZE_DECISION_TABLE);
DTAnalysis analysis = getAnalysis(validate, "_BA703D04-803A-44AA-8A31-F5EEDD4FD54E");
assertThat(analysis.getGaps(), hasSize(0));
// assert OVERLAPs count.
assertThat(analysis.getOverlaps(), hasSize(1));
@SuppressWarnings({ "unchecked", "rawtypes" }) List<Overlap> overlaps = Arrays.asList(new Overlap(Arrays.asList(2, 1), new Hyperrectangle(1, Arrays.asList(Interval.newFromBounds(new Bound(new BigDecimal("18"), RangeBoundary.CLOSED, null), new Bound(Interval.POS_INF, RangeBoundary.CLOSED, null))))));
assertThat(overlaps, hasSize(1));
// Assert OVERLAPs same values
assertThat(analysis.getOverlaps(), contains(overlaps.toArray()));
// MaskedRules count.
assertThat(analysis.getMaskedRules(), hasSize(1));
List<MaskedRule> maskedRules = Arrays.asList(new MaskedRule(1, 2));
assertThat(maskedRules, hasSize(1));
assertThat(analysis.getMaskedRules(), contains(maskedRules.toArray()));
assertTrue("It should contain at least 1 DMNMessage for the MaskedRule", validate.stream().anyMatch(p -> p.getMessageType().equals(DMNMessageType.DECISION_TABLE_MASKED_RULE)));
assertTrue("It should not contain DMNMessage for the MisleadingRule", validate.stream().noneMatch(p -> p.getMessageType().equals(DMNMessageType.DECISION_TABLE_MISLEADING_RULE)));
}
use of org.kie.dmn.validation.dtanalysis.model.DTAnalysis in project drools by kiegroup.
the class NullTest method checkNullBoolean.
private void checkNullBoolean(List<DMNMessage> validate) {
DTAnalysis analysis = getAnalysis(validate, "_76FABA99-C6D0-4C83-81BF-92E807DBDEF8");
assertThat(analysis.getGaps(), hasSize(1));
@SuppressWarnings({ "unchecked", "rawtypes" }) List<Hyperrectangle> gaps = Arrays.asList(new Hyperrectangle(1, Arrays.asList(Interval.newFromBounds(new Bound(true, RangeBoundary.CLOSED, null), new Bound(true, RangeBoundary.CLOSED, null)))));
assertThat(gaps, hasSize(1));
// Assert GAPS
assertThat(analysis.getGaps(), contains(gaps.toArray()));
// assert OVERLAPs count.
assertThat(analysis.getOverlaps(), hasSize(0));
}
use of org.kie.dmn.validation.dtanalysis.model.DTAnalysis in project drools by kiegroup.
the class NullTest method checkNullNumber.
private void checkNullNumber(List<DMNMessage> validate) {
DTAnalysis analysis = getAnalysis(validate, "_76FABA99-C6D0-4C83-81BF-92E807DBDEF8");
assertThat(analysis.getGaps(), hasSize(1));
@SuppressWarnings({ "unchecked", "rawtypes" }) List<Hyperrectangle> gaps = Arrays.asList(new Hyperrectangle(1, Arrays.asList(Interval.newFromBounds(new Bound(new BigDecimal("0"), RangeBoundary.CLOSED, null), new Bound(Interval.POS_INF, RangeBoundary.CLOSED, null)))));
assertThat(gaps, hasSize(1));
// Assert GAPS
assertThat(analysis.getGaps(), contains(gaps.toArray()));
// assert OVERLAPs count.
assertThat(analysis.getOverlaps(), hasSize(0));
}
use of org.kie.dmn.validation.dtanalysis.model.DTAnalysis in project drools by kiegroup.
the class RuleOrderDashTest method test.
@Test
public void test() {
List<DMNMessage> validate = validator.validate(getReader("RuleOrderDash.dmn"), ANALYZE_DECISION_TABLE);
DTAnalysis analysis = getAnalysis(validate, "_eb02106a-cee1-47f5-a9d9-3160c5ac868b");
// Assert GAPS count.
assertThat(analysis.getGaps(), hasSize(0));
// assert OVERLAPs count.
assertThat(analysis.getOverlaps(), hasSize(3));
@SuppressWarnings({ "unchecked", "rawtypes" }) List<Overlap> overlaps = Arrays.asList(new Overlap(Arrays.asList(3, 1), new Hyperrectangle(2, Arrays.asList(Interval.newFromBounds(new Bound(Interval.NEG_INF, RangeBoundary.CLOSED, null), new Bound(new BigDecimal("60"), RangeBoundary.OPEN, null)), Interval.newFromBounds(new Bound(new BigDecimal("30"), RangeBoundary.CLOSED, null), new Bound(Interval.POS_INF, RangeBoundary.CLOSED, null))))), new Overlap(Arrays.asList(2, 3), new Hyperrectangle(2, Arrays.asList(Interval.newFromBounds(new Bound(new BigDecimal("60"), RangeBoundary.CLOSED, null), new Bound(Interval.POS_INF, RangeBoundary.CLOSED, null)), Interval.newFromBounds(new Bound(Interval.NEG_INF, RangeBoundary.CLOSED, null), new Bound(new BigDecimal("30"), RangeBoundary.OPEN, null))))), new Overlap(Arrays.asList(2, 3, 1), new Hyperrectangle(2, Arrays.asList(Interval.newFromBounds(new Bound(new BigDecimal("60"), RangeBoundary.CLOSED, null), new Bound(Interval.POS_INF, RangeBoundary.CLOSED, null)), Interval.newFromBounds(new Bound(new BigDecimal("30"), RangeBoundary.CLOSED, null), new Bound(Interval.POS_INF, RangeBoundary.CLOSED, null))))));
assertThat(overlaps, hasSize(3));
// Assert OVERLAPs same values
assertThat(analysis.getOverlaps(), contains(overlaps.toArray()));
}
Aggregations