LoadBalancerResource { @DELETE @ApiOperation("Remove a load balancer") public Response removeLoadBalancer( @QueryParam("jobId") String jobId, @QueryParam("loadBalancerId") String loadBalancerId) { return Responses.fromCompletable(loadBalancerService.removeLoadBalancer( RemoveLoadBalancerRequest.newBuilder() .setJobId(jobId) .setLoadBalancerId(LoadBalancerId.newBuilder().setId(loadBalancerId).build()) .build(), resolveCallMetadata()) ); } @Inject  LoadBalancerResource(LoadBalancerService loadBalancerService,
                                SystemLogService systemLog,
                                CallMetadataResolver callMetadataResolver); @GET @ApiOperation("Find the load balancer(s) with the specified ID") @Path("/{jobId}") GetJobLoadBalancersResult getJobLoadBalancers(@PathParam("jobId") String jobId); @GET @ApiOperation("Get all load balancers") GetAllLoadBalancersResult getAllLoadBalancers(@Context UriInfo info); @POST @ApiOperation("Add a load balancer") Response addLoadBalancer(
            @QueryParam("jobId") String jobId,
            @QueryParam("loadBalancerId") String loadBalancerId); @DELETE @ApiOperation("Remove a load balancer") Response removeLoadBalancer(
            @QueryParam("jobId") String jobId,
            @QueryParam("loadBalancerId") String loadBalancerId);  }
@Test public void removeLoadBalancerSucceededTest() { when(loadBalancerService.removeLoadBalancer(any(), any())).thenReturn(Completable.complete()); Response response = loadBalancerResource.removeLoadBalancer(TEST_JOB_ID, TEST_LOAD_BALANCER_ID); assertEquals(200, response.getStatus()); }
@Test(expected = TitusServiceException.class) public void removeLoadBalancerFailedTest() { TitusServiceException exception = TitusServiceException.jobNotFound(TEST_JOB_ID); when(loadBalancerService.removeLoadBalancer(any(), any())).thenReturn(Completable.error(exception)); loadBalancerResource.removeLoadBalancer(TEST_JOB_ID, TEST_LOAD_BALANCER_ID); }