EnvironmentRestApi { @GET @Operation(summary = "List of Environments", tags = {"environments"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema( implementation = Environment.class)))}) public Response listEnvironment(@QueryParam("status") String status) { try { List<Environment> environmentList = environmentManager.listEnvironments(status); return new JsonResponse.Builder<List<Environment>>(Response.Status.OK) .success(true).result(environmentList).build(); } catch (SubmarineRuntimeException e) { return parseEnvironmentServiceException(e); } }  @POST @Consumes({RestConstants.MEDIA_TYPE_YAML, MediaType.APPLICATION_JSON}) @Operation(summary = "Create a environment", tags = {"environment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema( implementation = Environment.class)))}) Response createEnvironment(EnvironmentSpec spec); @PATCH @Path("/{id}") @Consumes({RestConstants.MEDIA_TYPE_YAML, MediaType.APPLICATION_JSON}) @Operation(summary = "Update the environment with job spec", tags = {"environments"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema( implementation = Environment.class))), @ApiResponse( responseCode = "404", description = "Environment not found")}) Response updateEnvironment(
      @PathParam(RestConstants.ENVIRONMENT_ID) String name,
      EnvironmentSpec spec); @DELETE @Path("/{id}") @Operation(summary = "Delete the environment", tags = {"environments"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = Environment.class))), @ApiResponse( responseCode = "404", description = "Environment not found")}) Response deleteEnvironment(
      @PathParam(RestConstants.ENVIRONMENT_ID) String name); @GET @Operation(summary = "List of Environments", tags = {"environments"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema( implementation = Environment.class)))}) Response listEnvironment(@QueryParam("status") String status); @GET @Path("/{id}") @Operation(summary = "Find environment by name", tags = {"environment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = Environment.class))), @ApiResponse( responseCode = "404", description = "Environment not found")}) Response getEnvironment(
      @PathParam(RestConstants.ENVIRONMENT_ID) String name);  }
@Test public void listEnvironment() { Response getEnvResponse = environmentStoreApi.listEnvironment(""); String entity = (String) getEnvResponse.getEntity(); JsonResponse jsonResponse = gson.fromJson(entity, JsonResponse.class); Environment[] environments = gson .fromJson(gson.toJson(jsonResponse.getResult()), Environment[].class); assertEquals(2, environments.length); Environment environment = environments[0]; assertEquals("foo", environment.getEnvironmentSpec().getName()); assertEquals(kernelName, environment.getEnvironmentSpec().getKernelSpec().getName()); assertEquals(kernelChannels, environment.getEnvironmentSpec().getKernelSpec().getChannels()); assertEquals(kernelDependencies, environment.getEnvironmentSpec().getKernelSpec().getDependencies()); assertEquals("continuumio/miniconda", environment.getEnvironmentSpec().getDockerImage()); }