### Question:
AlgorithmExecutionResource { protected ExecutionSetting buildExecutionSetting(AlgorithmExecutionParams params) throws AlgorithmConfigurationException { ExecutionSetting executionSetting = null; DefaultConfigurationFactory configurationFactory = new DefaultConfigurationFactory(); List<ConfigurationValue> parameterValues = new LinkedList<>(); List<Input> inputs = new ArrayList<>(); FileInputResource fileInputResource = new FileInputResource(); TableInputResource tableInputResource = new TableInputResource(); DatabaseConnectionResource databaseConnectionResource = new DatabaseConnectionResource(); for (ConfigurationRequirement<?> requirement : params.getRequirements()) { if (requirement.getSettings().length == 0) { continue; } try { parameterValues.add(requirement.build(configurationFactory)); } catch (FileNotFoundException e) { e.printStackTrace(); } for (ConfigurationSetting setting : requirement.getSettings()) { if (setting instanceof ConfigurationSettingFileInput) { inputs.add(fileInputResource.get(((ConfigurationSettingFileInput) setting).getId())); } else if (setting instanceof ConfigurationSettingDatabaseConnection) { inputs.add(databaseConnectionResource .get(((ConfigurationSettingDatabaseConnection) setting).getId())); } else if (setting instanceof ConfigurationSettingTableInput) { inputs.add(tableInputResource.get(((ConfigurationSettingTableInput) setting).getId())); } } } List<String> parameterValuesJson = configurationValuesToJson(parameterValues); List<String> inputsJson = inputsToJson(inputs); executionSetting = new ExecutionSetting(parameterValuesJson, inputsJson, params.getExecutionIdentifier()) .setCacheResults(params.getCacheResults()) .setWriteResults(params.getWriteResults()) .setCountResults(params.getCountResults()); return executionSetting; }  @POST @Path("/stop/{identifier}") void stopExecution(@PathParam("identifier") String executionIdentifier); @POST @Consumes(Constants.APPLICATION_JSON_RESOURCE_PATH) @Produces(Constants.APPLICATION_JSON_RESOURCE_PATH) Execution executeAlgorithm(AlgorithmExecutionParams params); List<String> configurationValuesToJson(List<ConfigurationValue> parameterValues); List<String> inputsToJson(List<Input> inputs);  }### Answer:
@Test public void testBuildExecutionSetting() throws Exception { int expectedAlgorithmId = 42; String expectedExecutionIdentifier = "myIdentifier"; Boolean expectedCountResults = true; List<ConfigurationRequirement> expectedRequirements = new ArrayList<>(); ConfigurationRequirementFileInput requirement = new ConfigurationRequirementFileInput( ExampleAlgorithm.RELATIONAL_INPUT_IDENTIFIER); String path = new FileFixture("some file content").getTestData("some file name").getPath(); requirement.checkAndSetSettings(new ConfigurationSettingFileInput(path)); expectedRequirements.add(requirement); AlgorithmExecutionParams params = new AlgorithmExecutionParams() .setAlgorithmId(expectedAlgorithmId) .setExecutionIdentifier(expectedExecutionIdentifier) .setCountResults(expectedCountResults) .setRequirements(expectedRequirements); ConfigurationValueFileInputGenerator expectedConfigValue = new ConfigurationValueFileInputGenerator(requirement); ExecutionSetting executionSetting = algorithmExecutionResource.buildExecutionSetting(params); assertEquals(expectedCountResults, executionSetting.getCountResults()); assertEquals(expectedExecutionIdentifier, executionSetting.getExecutionIdentifier()); List<ConfigurationValue> configurationValues = AlgorithmExecution.parseConfigurationValues(executionSetting.getParameterValuesJson()); ConfigurationValue configValue = configurationValues.get(0); assertTrue(configValue instanceof ConfigurationValueFileInputGenerator); ConfigurationValueFileInputGenerator actualConfigValue = (ConfigurationValueFileInputGenerator) configValue; assertEquals(expectedConfigValue.getIdentifier(), actualConfigValue.getIdentifier()); }