@Test
public void populateWithPMMLRuleMappers() {

    final List<KiePMMLModel> toPopulate = new ArrayList<>();
    toPopulate.add( new KiePMMLModelHasSourceMap("TEST", Collections.emptyList()));
    toPopulate.add( new KiePMMLModelHasRule("TEST", Collections.emptyList()));
    toPopulate.add( new KiePMMLModelHasNestedModelsHasRule("TEST", Collections.emptyList()));
    toPopulate.add( new KiePMMLModelHasNestedModelsHasSourceMap("TEST", Collections.emptyList()));
    toPopulate.forEach(kiePMMLModel -> assertTrue(((HasSourcesMap) kiePMMLModel).getSourcesMap().isEmpty()));
    final File file = new File("foo.pmml");
    final Resource resource = new FileSystemResource(file);
    PMMLCompilerService.populateWithPMMLRuleMappers(toPopulate, resource);
    toPopulate.forEach(kiePmmlModel -> {
        if (kiePmmlModel instanceof HasRule || kiePmmlModel instanceof KiePMMLModelHasNestedModelsHasRule) {
            assertFalse(((HasSourcesMap) kiePmmlModel).getSourcesMap().isEmpty());
            String expected =  kiePmmlModel.getKModulePackageName() + "." + KIE_PMML_RULE_MAPPERS_CLASS_NAME;
            assertTrue(((HasSourcesMap) kiePmmlModel).getSourcesMap().containsKey(expected));
            if (kiePmmlModel instanceof HasRule) {
                expected =  kiePmmlModel.getKModulePackageName() + "." + KIE_PMML_RULE_MAPPER_CLASS_NAME;
                assertTrue(((HasSourcesMap) kiePmmlModel).getSourcesMap().containsKey(expected));
            }
        } else {
            assertTrue(((HasSourcesMap) kiePmmlModel).getSourcesMap().isEmpty());
        }
    });
}