MockMvcController { @RequestMapping("/rest/{id}") Role rest(@PathVariable Integer id){ Role role = roleRepository.findOne(id); logger.info("Role Info: {}", role.toString()); return role; }    }
@Test public void testRest()throws Exception{ given(this.roleRepository.findOne(2)).willReturn(new Role(2, "ROLE_USER")); String content = mockMvc.perform(get("/mock/rest/2")) .andExpect(status().is(200)).andReturn().getResponse().getContentAsString(); System.out.println(content); }