### Question:
ExecutionResource { @DELETE @Path("/delete/{id}") public void delete(@PathParam("id") long id) { try { Execution execution = (Execution) HibernateUtil.retrieve(Execution.class, id); Set<Result> results = execution.getResults(); HibernateUtil.delete(execution); for (Result result : results) { File file = new File(result.getFileName()); if (file.exists()) { file.delete(); } } } catch (Exception e) { e.printStackTrace(); throw new WebException(e, Response.Status.BAD_REQUEST); } }  @DELETE @Path("/delete/{id}") void delete(@PathParam("id") long id); @GET @Path("/get/{id}") @Produces(Constants.APPLICATION_JSON_RESOURCE_PATH) Execution get(@PathParam("id") long id); @GET @Produces(Constants.APPLICATION_JSON_RESOURCE_PATH) @SuppressWarnings(Constants.SUPPRESS_WARNINGS_UNCHECKED) List<Execution> getAll(); @GET @Path("/count-results/{executionId}") @Produces(Constants.APPLICATION_JSON_RESOURCE_PATH) Map<String, Integer> readCounterResult(@PathParam("executionId") long id);  }### Answer:
@Test public void testDelete() throws EntityStorageException, IOException { HibernateUtil.clear(); String fileName = "result_ind"; File f = new File(fileName); f.createNewFile(); Algorithm algorithm = new Algorithm("example_ind_algorithm.jar"); Result result = new Result(fileName); algorithmResource.store(algorithm); HibernateUtil.store(result); Execution execution = new Execution(algorithm); execution.addResult(result); HibernateUtil.store(execution); assertEquals(execution, execution); assertFalse(executionResource.getAll().isEmpty()); assertTrue(f.exists()); executionResource.delete(execution.getId()); assertTrue(executionResource.getAll().isEmpty()); assertFalse(f.exists()); HibernateUtil.clear(); }