MockMvcController { @RequestMapping("/all") String all( ){ List<Role> roles = roleRepository.findAll(); logger.info("Roles Size: {}", roles.size()); return SUCCESS; }    }
@Test public void testAll() throws Exception{ given(this.roleRepository.findAll()) .willReturn(Arrays.asList(new Role(1, "ROLE_ADMIN"), new Role(2, "ROLE_USER"))); mockMvc.perform(get("/mock/all")) .andExpect(status().is(200)) .andExpect(content().string("success")); }