static void populateIndexFile(IndexFile toPopulate, EfestoCompilationOutput compilationOutput) {
        try {
            GeneratedResources generatedResources = getGeneratedResourcesObject(toPopulate);
            populateGeneratedResources(generatedResources, compilationOutput);
            writeGeneratedResourcesObject(generatedResources, toPopulate);
        } catch (Exception e) {
            throw new KieCompilerServiceException(e);
        }
    }
@Test
    void populateIndexFile() throws Exception {
        IndexFile toPopulate = CompilationManagerUtils.getIndexFile(finalOutput);
        GeneratedResources originalGeneratedResources = getGeneratedResourcesObject(toPopulate);
        int expectedResources = 2; // 1 final resource + 1 intermediate resources
        assertThat(originalGeneratedResources).hasSize(expectedResources);
        CompilationManagerUtils.populateIndexFile(toPopulate, finalOutput);
        GeneratedResources generatedResources = getGeneratedResourcesObject(toPopulate);
        expectedResources = 6; // 2 final resource + 4 class resources
        assertThat(generatedResources).hasSize(expectedResources);
        List<GeneratedExecutableResource> executableResources = generatedResources.stream().filter(generatedResource -> generatedResource instanceof GeneratedExecutableResource).map(GeneratedExecutableResource.class::cast).collect(Collectors.toList());
        expectedResources = 2; // 2 final resource
        assertThat(executableResources).hasSize(expectedResources);

        GeneratedExecutableResource finalResource = executableResources.stream().filter(generatedExecutableResource -> finalOutput.getModelLocalUriId().equals(generatedExecutableResource.getModelLocalUriId())).findFirst().orElse(null);

        commonEvaluateGeneratedExecutableResource(finalResource);
        List<GeneratedClassResource> classResources = generatedResources.stream().filter(generatedResource -> generatedResource instanceof GeneratedClassResource).map(GeneratedClassResource.class::cast).collect(Collectors.toList());
        expectedResources = 4; // 4 class resources
        assertThat(classResources).hasSize(expectedResources);

        List<GeneratedResource> classResourcesGenerated = classResources.stream().filter(generatedResource -> !generatedResource.getFullClassName().equals("type")).collect(Collectors.toList());
        commonEvaluateGeneratedIntermediateResources(classResourcesGenerated);

        // restore clean situation
        writeGeneratedResourcesObject(originalGeneratedResources, toPopulate);
    }