static PMMLRuntimeContext getPMMLRuntimeContext(PMMLRequestData pmmlRequestData,
                                                    final Map<String, GeneratedResources> generatedResourcesMap) {
        String fileName = (String) pmmlRequestData.getMappedRequestParams().get(PMML_FILE_NAME).getValue();
        PMMLRequestData cleaned = new PMMLRequestData(pmmlRequestData.getCorrelationId(),
                                                      pmmlRequestData.getModelName());
        pmmlRequestData.getRequestParams().stream()
                .filter(parameterInfo -> !parameterInfo.getName().equals(PMML_FILE_NAME) && !parameterInfo.getName().equals(PMML_MODEL_NAME))
                .forEach(cleaned::addRequestParam);
        PMMLRuntimeContext toReturn = new PMMLRuntimeContextImpl(cleaned, fileName,
                                                                 new KieMemoryCompiler.MemoryCompilerClassLoader(Thread.currentThread().getContextClassLoader()));
        toReturn.getGeneratedResourcesMap().putAll(generatedResourcesMap);
        return toReturn;
    }
@Test
    void getPMMLRuntimeContextFromPMMLRequestData() {
        PMMLRequestData pmmlRequestData = getPMMLRequestDataWithInputData(MODEL_NAME, FILE_NAME);
        Map<String, ParameterInfo> mappedRequestParams = pmmlRequestData.getMappedRequestParams();

        final Map<String, GeneratedResources> generatedResourcesMap = new HashMap<>();
        IntStream.range(0, 3).forEach(value -> generatedResourcesMap.put("GenRes_" + value, new GeneratedResources()));

        PMMLRuntimeContext retrieved = PMMLRuntimeHelper.getPMMLRuntimeContext(pmmlRequestData, generatedResourcesMap);
        assertThat(retrieved).isNotNull();
        PMMLRequestData pmmlRequestDataRetrieved = retrieved.getRequestData();
        assertThat(pmmlRequestDataRetrieved).isNotNull();
        assertThat(pmmlRequestDataRetrieved.getMappedRequestParams()).hasSize(mappedRequestParams.size() - 2); //
        // Removing PMML_FILE_NAME and PMML_MODEL_NAME
        assertThat(pmmlRequestDataRetrieved.getMappedRequestParams().entrySet())
                .allMatch(entry -> mappedRequestParams.containsKey(entry.getKey()) &&
                        entry.getValue().getValue().equals(mappedRequestParams.get(entry.getKey()).getValue()));
        Map<String, GeneratedResources> generatedResourcesMapRetrieved = retrieved.getGeneratedResourcesMap();
        assertThat(generatedResourcesMapRetrieved).hasSize(generatedResourcesMap.size() + 1);  // PMMLRuntimeContext
        // already contains "pmml" GeneratedResources
        assertThat(generatedResourcesMap.entrySet())
                .allMatch(entry -> generatedResourcesMapRetrieved.containsKey(entry.getKey()) &&
                        entry.getValue().equals(generatedResourcesMapRetrieved.get(entry.getKey())));
    }