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 getPMMLRuntimeContextFromMap() {
        Map<String, Object> inputData = getInputData(MODEL_NAME, FILE_NAME);
        final Random random = new Random();
        IntStream.range(0, 3).forEach(value -> inputData.put("Variable_" + value, random.nextInt(10)));
        final Map<String, GeneratedResources> generatedResourcesMap = new HashMap<>();
        IntStream.range(0, 3).forEach(value -> generatedResourcesMap.put("GenRes_" + value, new GeneratedResources()));
        PMMLRuntimeContext retrieved = PMMLRuntimeHelper.getPMMLRuntimeContext(inputData, generatedResourcesMap);
        assertThat(retrieved).isNotNull();
        PMMLRequestData pmmlRequestDataRetrieved = retrieved.getRequestData();
        assertThat(pmmlRequestDataRetrieved).isNotNull();
        assertThat(pmmlRequestDataRetrieved.getMappedRequestParams()).hasSize(inputData.size() - 2); // Removing
        // PMML_FILE_NAME and PMML_MODEL_NAME
        assertThat(pmmlRequestDataRetrieved.getMappedRequestParams().entrySet())
                .allMatch(entry -> inputData.containsKey(entry.getKey()) &&
                        entry.getValue().getValue().equals(inputData.get(entry.getKey())));
        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())));
    }