TaskDataProviderController { @RequestMapping(value = "datasource", method = RequestMethod.GET) @ResponseBody public List<TaskDataProviderDto> getAllDataProviders() { return taskWebService.getProviders(); } @Autowired  TaskDataProviderController(TaskWebService taskWebService); @RequestMapping(value = "datasource", method = RequestMethod.GET) @ResponseBody List<TaskDataProviderDto> getAllDataProviders();  }
@Test public void testGetAllDataProviders() throws Exception { List<TaskDataProviderDto> expected = new ArrayList<>(); when(taskWebService.getProviders()).thenReturn(expected); List<TaskDataProviderDto> actual = controller.getAllDataProviders(); assertNotNull(actual); assertEquals(expected, actual); }