ExperimentRestApi { @DELETE @Path("/{id}") @Operation(summary = "Delete the experiment", tags = {"experiment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = JsonResponse.class))), @ApiResponse(responseCode = "404", description = "Experiment not found")}) public Response deleteExperiment(@PathParam(RestConstants.ID) String id) { try { Experiment experiment = experimentManager.deleteExperiment(id); return new JsonResponse.Builder<Experiment>(Response.Status.OK).success(true) .result(experiment).build(); } catch (SubmarineRuntimeException e) { return parseExperimentServiceException(e); } }  @VisibleForTesting void setExperimentManager(ExperimentManager experimentManager); @GET @Path(RestConstants.PING) @Consumes(MediaType.APPLICATION_JSON) @Operation(summary = "Ping submarine server", tags = {"experiment"}, description = "Return the Pong message for test the connectivity", responses = { @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = String.class)))}) Response ping(); @POST @Consumes({RestConstants.MEDIA_TYPE_YAML, MediaType.APPLICATION_JSON}) @Operation(summary = "Create an experiment", tags = {"experiment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = JsonResponse.class)))}) Response createExperiment(ExperimentSpec spec); @POST @Path("/{name}") @Consumes({RestConstants.MEDIA_TYPE_YAML, MediaType.APPLICATION_JSON}) @Operation(summary = "use experiment template to create an experiment", tags = {"experiment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = JsonResponse.class)))}) Response SubmitExperimentTemplate(@PathParam("name") String name, 
        ExperimentTemplateSubmit spec); @GET @Operation(summary = "List experiments", tags = {"experiment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = JsonResponse.class)))}) Response listExperiments(@QueryParam("status") String status); @GET @Path("/{id}") @Operation(summary = "Get the experiment's detailed info by id", tags = {"experiment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = JsonResponse.class))), @ApiResponse(responseCode = "404", description = "Experiment not found")}) Response getExperiment(@PathParam(RestConstants.ID) String id); @PATCH @Path("/{id}") @Consumes({RestConstants.MEDIA_TYPE_YAML, MediaType.APPLICATION_JSON}) @Operation(summary = "Update the experiment in the submarine server with spec", tags = {"experiment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = JsonResponse.class))), @ApiResponse(responseCode = "404", description = "Experiment not found")}) Response patchExperiment(@PathParam(RestConstants.ID) String id, ExperimentSpec spec); @DELETE @Path("/{id}") @Operation(summary = "Delete the experiment", tags = {"experiment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = JsonResponse.class))), @ApiResponse(responseCode = "404", description = "Experiment not found")}) Response deleteExperiment(@PathParam(RestConstants.ID) String id); @GET @Path("/logs") @Operation(summary = "List experiment's log", tags = {"experiment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = JsonResponse.class)))}) Response listLog(@QueryParam("status") String status); @GET @Path("/logs/{id}") @Operation(summary = "Log experiment by id", tags = {"experiment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = JsonResponse.class))), @ApiResponse(responseCode = "404", description = "Experiment not found")}) Response getLog(@PathParam(RestConstants.ID) String id);  }
@Test public void testDeleteExperiment() { String log1ID = "experiment_1597012631706_0002"; when(mockExperimentManager.deleteExperiment(log1ID)).thenReturn(actualExperiment); Response deleteExperimentResponse = experimentRestApi.deleteExperiment(log1ID); Experiment result = getResultFromResponse(deleteExperimentResponse, Experiment.class); verifyResult(result, experimentUid); }