### Question:
LoadBalanceController { @RequestMapping(value = "/{id}", method = RequestMethod.PUT) public boolean updateLoadbalance(@PathVariable String id, @RequestBody BalancingDTO balancingDTO, @PathVariable String env) throws ParamValidationException { if (id == null) { throw new ParamValidationException("Unknown ID!"); } id = id.replace(Constants.ANY_VALUE, Constants.PATH_SEPARATOR); BalancingDTO balancing = overrideService.findBalance(id); if (balancing == null) { throw new ResourceNotFoundException("Unknown ID!"); } overrideService.saveBalance(balancingDTO); return true; } @Autowired  LoadBalanceController(OverrideService overrideService, ProviderService providerService); @RequestMapping(method = RequestMethod.POST) @ResponseStatus(HttpStatus.CREATED) boolean createLoadbalance(@RequestBody BalancingDTO balancingDTO, @PathVariable String env); @RequestMapping(value = "/{id}", method = RequestMethod.PUT) boolean updateLoadbalance(@PathVariable String id, @RequestBody BalancingDTO balancingDTO, @PathVariable String env); @RequestMapping(method = RequestMethod.GET) List<BalancingDTO> searchLoadbalances(@RequestParam(required = false) String service,
                                                 @RequestParam(required = false) String application,
                                                 @PathVariable String env); @RequestMapping(value = "/{id}", method = RequestMethod.GET) BalancingDTO detailLoadBalance(@PathVariable String id, @PathVariable String env); @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) boolean deleteLoadBalance(@PathVariable String id, @PathVariable String env);  }### Answer:
@Test public void updateLoadbalance() throws IOException { String id = "1"; BalancingDTO balancingDTO = new BalancingDTO(); URI uri; ResponseEntity<String> response; response = restTemplate.exchange(url("/api/{env}/rules/balancing/{id}"), HttpMethod.PUT, new HttpEntity<>(balancingDTO, null), String.class, env, id); assertFalse("should return a fail response, when id is null", (Boolean) objectMapper.readValue(response.getBody(), Map.class).get("success")); BalancingDTO balancing = mock(BalancingDTO.class); when(overrideService.findBalance(id)).thenReturn(balancing); assertTrue(restTemplate.exchange(url("/api/{env}/rules/balancing/{id}"), HttpMethod.PUT, new HttpEntity<>(balancingDTO, null), Boolean.class, env, id).getBody()); verify(overrideService).saveBalance(any(BalancingDTO.class)); }