UserController extends BaseController { @RequestMapping(path = "", method = RequestMethod.GET) public String index( final Model model, final Pageable pageable, @RequestParam Map<String,String> allParams, final RedirectAttributes redirectAttributes ) { setupBreadCrumbs(model, null, null); if (redirectIfUsingLdapAuthentication(redirectAttributes)) { return "redirect:/"; } final Datatable.Builder<User> builder = Datatable.newBuilder(User.class) .withRepository(userRepository) .withPageable(pageable) .withRequestParams(allParams) .withUrl("/configuration/user") .withLabel("Users") .withConstraint("isActive", true, ConstraintOperator.EQUALS) .withCreateLink("/configuration/user/create") .withColumn(DatatableColumn.newBuilder(User.class) .withFieldName("email") .withLabel("Email") .withRenderFunction(User::getEmail) .withIsSortable(true) .build()) .withColumn(DatatableColumn.newBuilder(User.class) .withFieldName("displayName") .withLabel("Name") .withRenderFunction(User::getDisplayName) .withIsSortable(true) .build()) .withColumn(DatatableColumn.newBuilder(User.class) .withFieldName("role") .withLabel("Role") .withRenderFunction((user) -> { switch (user.getRole()) { case ROLE_ADMIN: return "Admin"; case ROLE_USER: return "User"; default: return "Unknown"; } }) .withIsSortable(true) .build()) .withColumn(DatatableColumn.newBuilder(User.class) .withLabel("Action") .withFieldName("id") .withIsSortable(false) .withHeaderAlignRight() .withRenderTemplate(ActionTemplate.newBuilder(User.class) .withEditLink(User.class, (record) -> "/configuration/user/edit/" + record.getId()) .withDeleteLink(User.class, (record) -> "/configuration/user/delete/" + record.getId()) .build()) .build()) .withSearch("email", "displayName"); model.addAttribute("datatable", builder.build()); return "configuration/user/index"; }  @RequestMapping(path = "", method = RequestMethod.GET) String index(
        final Model model,
        final Pageable pageable,
        @RequestParam Map<String,String> allParams,
        final RedirectAttributes redirectAttributes
    ); @RequestMapping(path = "/create", method = RequestMethod.GET) String createUser(final UserForm userForm, final Model model, final RedirectAttributes redirectAttributes); @RequestMapping(path = "/edit/{id}", method = RequestMethod.GET) String editUserForm(
        @PathVariable final Long id,
        final UserForm userForm,
        final RedirectAttributes redirectAttributes,
        final Model model); @RequestMapping(path = "/update", method = RequestMethod.POST) String update(
        @Valid final UserForm userForm,
        final BindingResult bindingResult,
        final RedirectAttributes redirectAttributes,
        final Model model); @RequestMapping(path = "/delete/{id}", method = RequestMethod.POST) String delete(@PathVariable final Long id, final RedirectAttributes redirectAttributes);  }
@Test @Transactional public void testIndex() throws Exception { mockMvc .perform(get("/configuration/user").with(user(adminUserDetails))) .andExpect(status().isOk()) .andExpect(content().string(containsString(adminUser.getEmail()))) .andExpect(content().string(containsString(adminUser.getDisplayName()))) .andExpect(content().string(containsString(nonAdminUser.getEmail()))) .andExpect(content().string(containsString(nonAdminUser.getDisplayName()))); }