### Question:
EntityManagerController { @RestAccessControl(permission = Permission.SUPERUSER) @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<PagedRestResponse<String>> getEntityManagers(RestListRequest requestList) throws JsonProcessingException { this.getEntityManagerValidator().validateRestListRequest(requestList, null); PagedMetadata<String> result = this.getEntityManagerService().getEntityManagers(requestList); logger.debug("Main Response -> {}", result); return new ResponseEntity<>(new PagedRestResponse<>(result), HttpStatus.OK); }  void setEntityManagerService(IEntityManagerService entityManagerService); EntityManagerValidator getEntityManagerValidator(); void setEntityManagerValidator(EntityManagerValidator entityManagerValidator); @RestAccessControl(permission = Permission.SUPERUSER) @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<PagedRestResponse<String>> getEntityManagers(RestListRequest requestList); @RestAccessControl(permission = Permission.SUPERUSER) @RequestMapping(value = "/{entityManagerCode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<SimpleRestResponse<EntityManagerDto>> getEntityManager(@PathVariable String entityManagerCode);  }### Answer:
@Test public void getEntityManagers_1() throws Exception { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24").grantedToRoleAdmin().build(); String accessToken = mockOAuthInterceptor(user); when(this.entityManagerService.getEntityManagers(any(RestListRequest.class))).thenReturn(new PagedMetadata<>()); ResultActions result = mockMvc.perform( get("/entityManagers") .param("page", "1") .param("pageSize", "4") .header("Authorization", "Bearer " + accessToken) ); result.andExpect(status().isOk()); RestListRequest restListReq = new RestListRequest(); restListReq.setPage(1); restListReq.setPageSize(4); Mockito.verify(this.entityManagerService, Mockito.times(1)).getEntityManagers(restListReq); }
@Test public void getEntityManagers_2() throws Exception { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24").grantedToRoleAdmin().build(); String accessToken = mockOAuthInterceptor(user); when(this.entityManagerService.getEntityManagers(any(RestListRequest.class))).thenReturn(new PagedMetadata<>()); ResultActions result = mockMvc.perform( get("/entityManagers").param("page", "1") .param("pageSize", "4") .param("filter[0].attribute", "code") .param("filter[0].value", "UserProfileManager") .header("Authorization", "Bearer " + accessToken) ); result.andExpect(status().isOk()); RestListRequest restListReq = new RestListRequest(); restListReq.setPage(1); restListReq.setPageSize(4); restListReq.addFilter(new Filter("code", "UserProfileManager")); Mockito.verify(this.entityManagerService, Mockito.times(1)).getEntityManagers(restListReq); }