AutoScalingSpringResource { @ApiOperation("Find scaling policies for a job") @GetMapping(path = "/scalingPolicies") public GetPolicyResult getAllScalingPolicies(CallMetadataAuthentication authentication) { return Responses.fromSingleValueObservable(autoScalingService.getAllScalingPolicies(authentication.getCallMetadata())); } @Inject  AutoScalingSpringResource(AutoScalingService autoScalingService); @ApiOperation("Find scaling policies for a job") @GetMapping(path = "/scalingPolicies") GetPolicyResult getAllScalingPolicies(CallMetadataAuthentication authentication); @ApiOperation("Find scaling policies for a job") @GetMapping(path = "/scalingPolicies/{jobId}") GetPolicyResult getScalingPolicyForJob(@PathVariable("jobId") String jobId, CallMetadataAuthentication authentication); @ApiOperation("Create or Update scaling policy") @PostMapping(path = "/scalingPolicy") ScalingPolicyID setScalingPolicy(@RequestBody PutPolicyRequest putPolicyRequest, CallMetadataAuthentication authentication); @ApiOperation("Find scaling policy for a policy Id") @GetMapping(path = "scalingPolicy/{policyId}") GetPolicyResult getScalingPolicy(@PathVariable("policyId") String policyId, CallMetadataAuthentication authentication); @ApiOperation("Delete scaling policy") @DeleteMapping(path = "scalingPolicy/{policyId}") ResponseEntity<Void> removePolicy(@PathVariable("policyId") String policyId, CallMetadataAuthentication authentication); @ApiOperation("Update scaling policy") @PutMapping("scalingPolicy") ResponseEntity<Void> updateScalingPolicy(@RequestBody UpdatePolicyRequest updatePolicyRequest, CallMetadataAuthentication authentication);  }
@Test public void testGetAllScalingPolicies() throws Exception { when(serviceMock.getAllScalingPolicies(JUNIT_REST_CALL_METADATA)).thenReturn(Observable.just(GET_POLICY_RESULT)); GetPolicyResult entity = SpringMockMvcUtil.doGet(mockMvc, "/api/v3/autoscaling/scalingPolicies", GetPolicyResult.class); assertThat(entity).isEqualTo(GET_POLICY_RESULT); verify(serviceMock, times(1)).getAllScalingPolicies(JUNIT_REST_CALL_METADATA); }