@Test
public void addPredictorTerms() {

    final List<PredictorTerm> predictorTerms = IntStream.range(0, 3).mapToObj(index -> {
        String predictorName = "predictorName-" + index;
        double coefficient = 1.23 * index;
        String fieldRef = "fieldRef-" + index;
        return PMMLModelTestUtils.getPredictorTerm(predictorName, coefficient,
                                                   Collections.singletonList(fieldRef));
    }).collect(Collectors.toList());
    ClassOrInterfaceDeclaration tableTemplate = new ClassOrInterfaceDeclaration();
    Map<String, MethodDeclaration> retrieved =
            KiePMMLRegressionTableRegressionFactory.addPredictorTerms(predictorTerms, tableTemplate);
    assertEquals(predictorTerms.size(), retrieved.size());
    IntStream.range(0, predictorTerms.size()).forEach(index -> {
        PredictorTerm predictorTerm = predictorTerms.get(index);
        assertTrue(retrieved.containsKey(predictorTerm.getName().getValue()));
        MethodDeclaration methodDeclaration = retrieved.get(predictorTerm.getName().getValue());
        String expected = String.format("evaluatePredictorTerm%d", index + 1);
        assertEquals(expected, methodDeclaration.getNameAsString());
    });
}