LoadBalancerSpringResource { @ApiOperation("Get all load balancers") @GetMapping public GetAllLoadBalancersResult getAllLoadBalancers(@RequestParam MultiValueMap<String, String> queryParameters, CallMetadataAuthentication authentication) { Page page = RestUtil.createPage(queryParameters); logPageNumberUsage(systemLog, authentication.getCallMetadata(), getClass().getSimpleName(), "getAllLoadBalancers", page); return Responses.fromSingleValueObservable(loadBalancerService.getAllLoadBalancers( GetAllLoadBalancersRequest.newBuilder().setPage(page).build(), authentication.getCallMetadata() )); } @Inject  LoadBalancerSpringResource(LoadBalancerService loadBalancerService, SystemLogService systemLog); @ApiOperation("Find the load balancer(s) with the specified ID") @GetMapping(path = "/{jobId}") GetJobLoadBalancersResult getJobLoadBalancers(@PathVariable("jobId") String jobId, CallMetadataAuthentication authentication); @ApiOperation("Get all load balancers") @GetMapping GetAllLoadBalancersResult getAllLoadBalancers(@RequestParam MultiValueMap<String, String> queryParameters,
                                                         CallMetadataAuthentication authentication); @ApiOperation("Add a load balancer") @PostMapping ResponseEntity<Void> addLoadBalancer(
            @RequestParam("jobId") String jobId,
            @RequestParam("loadBalancerId") String loadBalancerId,
            CallMetadataAuthentication authentication); @ApiOperation("Remove a load balancer") @DeleteMapping ResponseEntity<Void> removeLoadBalancer(
            @RequestParam("jobId") String jobId,
            @RequestParam("loadBalancerId") String loadBalancerId,
            CallMetadataAuthentication authentication);  }
@Test public void testGetAllLoadBalancers() throws Exception { GetAllLoadBalancersRequest request = GetAllLoadBalancersRequest.newBuilder().setPage(NEXT_PAGE_OF_1).build(); GetAllLoadBalancersResult response = GetAllLoadBalancersResult.newBuilder() .setPagination(SpringMockMvcUtil.paginationOf(NEXT_PAGE_OF_1)) .addJobLoadBalancers(GET_JOB_LOAD_BALANCERS_RESULT) .build(); when(serviceMock.getAllLoadBalancers(request, JUNIT_REST_CALL_METADATA)).thenReturn(Observable.just(response)); GetAllLoadBalancersResult entity = SpringMockMvcUtil.doPaginatedGet(mockMvc, "/api/v3/loadBalancers", GetAllLoadBalancersResult.class, NEXT_PAGE_OF_1); assertThat(entity).isEqualTo(response); verify(serviceMock, times(1)).getAllLoadBalancers(request, JUNIT_REST_CALL_METADATA); }