### Question:
AlgorithmExecutionResource { @POST @Consumes(Constants.APPLICATION_JSON_RESOURCE_PATH) @Produces(Constants.APPLICATION_JSON_RESOURCE_PATH) public Execution executeAlgorithm(AlgorithmExecutionParams params) { String executionIdentifier = params.getExecutionIdentifier(); ExecutionSetting executionSetting = null; try { executionSetting = buildExecutionSetting(params); HibernateUtil.store(executionSetting); } catch (Exception e) { e.printStackTrace(); String message = "Could not build execution setting"; if (e.getMessage() != null) { message += ": " + e.getMessage(); } throw new WebException(message, Response.Status.BAD_REQUEST); } String exceptionMessage = ""; try { Process process = executeAlgorithm(String.valueOf(params.getAlgorithmId()), executionIdentifier, params.getMemory()); ProcessRegistry.getInstance().put(executionIdentifier, process); InputStreamReader isr = new InputStreamReader(process.getInputStream()); BufferedReader br = new BufferedReader(isr); String lineRead; while ((lineRead = br.readLine()) != null) { if (lineRead.contains("Exception") || lineRead.contains("Caused by: ")) { exceptionMessage = lineRead; } System.out.println(lineRead); } try { if (process.exitValue() != 0) { exceptionMessage = "Error in algorithm execution. " + exceptionMessage; } } catch (IllegalThreadStateException e) { process.destroy(); exceptionMessage = "Error in algorithm execution. " + exceptionMessage; } } catch (IOException | InterruptedException e) { e.printStackTrace(); } Execution execution; try { ArrayList<Criterion> criteria = new ArrayList<>(); criteria.add(Restrictions.eq("identifier", executionIdentifier)); criteria.add(Restrictions.eq("running",false)); execution = (Execution) HibernateUtil.queryCriteria(Execution.class, criteria.toArray( new Criterion[criteria.size()])) .get(0); } catch (Exception e) { try { ArrayList<Criterion> criteria = new ArrayList<>(); criteria.add(Restrictions.eq("identifier", executionIdentifier)); criteria.add(Restrictions.eq("running",true)); execution = (Execution) HibernateUtil.queryCriteria(Execution.class, criteria.toArray(new Criterion[criteria.size()])).get(0); execution = execution .setRunning(false) .setExecutionSetting(executionSetting) .setAborted(true) .setInputs(AlgorithmExecution.parseInputs(executionSetting.getInputsJson())); HibernateUtil.update(execution); } catch (IndexOutOfBoundsException e1) { throw new WebException(exceptionMessage, Response.Status.BAD_REQUEST); } catch (EntityStorageException e1) { e1.printStackTrace(); throw new WebException("Could not store execution.", Response.Status.BAD_REQUEST); } throw new WebException(exceptionMessage, Response.Status.BAD_REQUEST); } if (!executionSetting.getCountResults()) { try { ResultPostProcessor.extractAndStoreResultsDataIndependent(execution); } catch (Exception e) { e.printStackTrace(); String message = "Could not execute result post processing"; if (e.getMessage() != null) { message += ": " + e.getMessage(); } throw new WebException(message, Response.Status.BAD_REQUEST); } } ExecutionResponse executionResponse = new ExecutionResponse() .setAlgorithm(execution.getAlgorithm().getName()) .setIdentifier(execution.getIdentifier()) .setStarted(execution.getBegin()); return execution; }  @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 testExecuteAlgorithm() throws Exception { }