PMMLMiningModelEvaluator implements PMMLModelEvaluator<KiePMMLMiningModel> { void validateMining(final KiePMMLMiningModel toValidate) { if (toValidate.getTargetField() == null || StringUtils.isEmpty(toValidate.getTargetField().trim())) { throw new KiePMMLInternalException(String.format(TARGET_FIELD_REQUIRED_RETRIEVED, toValidate.getTargetField())); } }  @Override PMML_MODEL getPMMLModelType(); @Override PMML4Result evaluate(final KieBase knowledgeBase,
                                final KiePMMLMiningModel model,
                                final PMMLContext pmmlContext);  }
@Test public void validateMiningTargetField() { String name = "NAME"; KiePMMLMiningModel kiePMMLMiningModel = KiePMMLMiningModel.builder(name, Collections.emptyList(), MINING_FUNCTION.ASSOCIATION_RULES) .withTargetField("TARGET") .build(); evaluator.validateMining(kiePMMLMiningModel); }
@Test(expected = KiePMMLInternalException.class) public void validateMiningEmptyTargetField() { String name = "NAME"; KiePMMLMiningModel kiePMMLMiningModel = KiePMMLMiningModel.builder(name, Collections.emptyList(), MINING_FUNCTION.ASSOCIATION_RULES) .withTargetField(" ") .build(); evaluator.validateMining(kiePMMLMiningModel); }
@Test(expected = KiePMMLInternalException.class) public void validateMiningNoTargetField() { String name = "NAME"; KiePMMLMiningModel kiePMMLMiningModel = KiePMMLMiningModel.builder(name, Collections.emptyList(), MINING_FUNCTION.ASSOCIATION_RULES).build(); evaluator.validateMining(kiePMMLMiningModel); }