RegressionModelImplementationProvider implements ModelImplementationProvider<RegressionModel, KiePMMLRegressionModel> { protected void validate(final DataDictionary dataDictionary, final RegressionModel toValidate) { if (toValidate.getRegressionTables() == null || toValidate.getRegressionTables().isEmpty()) { throw new KiePMMLException("At least one RegressionTable required"); } if (isRegression(toValidate)) { List<KiePMMLNameOpType> targetFields = getTargetFields(dataDictionary, toValidate); validateRegression(targetFields, toValidate); } else { validateClassification(dataDictionary, toValidate); } }  @Override PMML_MODEL getPMMLModelType(); @Override KiePMMLRegressionModel getKiePMMLModel(final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final RegressionModel model, final Object kBuilder); @Override KiePMMLRegressionModel getKiePMMLModelFromPlugin(final String packageName, final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final RegressionModel model, final Object kBuilder);  }
@Test public void validateNoRegressionTables() throws Exception { final PMML pmml = TestUtils.loadFromFile(SOURCE_1); assertNotNull(pmml); assertEquals(1, pmml.getModels().size()); assertTrue(pmml.getModels().get(0) instanceof RegressionModel); RegressionModel regressionModel = (RegressionModel) pmml.getModels().get(0); regressionModel.getRegressionTables().clear(); try { PROVIDER.validate(pmml.getDataDictionary(), regressionModel); fail("Expecting validation failure due to missing RegressionTables"); } catch (KiePMMLException e) { } regressionModel = new RegressionModel(regressionModel.getMiningFunction(), regressionModel.getMiningSchema(), null); try { PROVIDER.validate(pmml.getDataDictionary(), regressionModel); fail("Expecting validation failure due to missing RegressionTables"); } catch (KiePMMLException e) { } }