@Test
public void addMapPopulation() {

    final BlockStmt body = new BlockStmt();
    final LinkedHashMap<String, KiePMMLTableSourceCategory> regressionTablesMap = new LinkedHashMap<>();
    IntStream.range(0, 3).forEach(index ->
                                          regressionTablesMap.put("KEY" + index,
                                                                  new KiePMMLTableSourceCategory("SOURCE-" + index, "CATEGORY-" + index)));
    KiePMMLRegressionTableClassificationFactory.addMapPopulation(body, regressionTablesMap);
    NodeList<Statement> retrieved = body.getStatements();
    assertEquals(regressionTablesMap.size(), retrieved.size());
    retrieved.forEach(statement -> {
        assertTrue(statement instanceof ExpressionStmt);
        assertTrue(((ExpressionStmt) statement).getExpression() instanceof MethodCallExpr);
        MethodCallExpr methodCallExpr = (MethodCallExpr) ((ExpressionStmt) statement).getExpression();
        assertEquals("categoryTableMap", methodCallExpr.getScope().get().asNameExpr().toString());
        assertEquals("put", methodCallExpr.getName().asString());
    });
    final List<MethodCallExpr> methodCallExprs = retrieved.stream()
            .map(statement -> (MethodCallExpr) ((ExpressionStmt) statement).getExpression())
            .collect(Collectors.toList());
   IntStream.range(0, 3).forEach(index -> {
       String key = "KEY" + index;
       KiePMMLTableSourceCategory kiePMMLTableSourceCategory = regressionTablesMap.get(key);
       MethodCallExpr methodCallExpr = methodCallExprs.get(index);
       StringLiteralExpr stringLiteralExpr = (StringLiteralExpr) methodCallExpr.getArguments().get(0);
       assertEquals(kiePMMLTableSourceCategory.getCategory(), stringLiteralExpr.getValue());
       ObjectCreationExpr objectCreationExpr = (ObjectCreationExpr) methodCallExpr.getArguments().get(1);
       assertEquals(key, objectCreationExpr.getTypeAsString());
   });
}