DataProviderRestController { @RequestMapping(value = "/dataProviders/{dataProviderName}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_DATA_PROVIDERS_GET) public DataProvider getDataProvider(@PathVariable("dataProviderName") String dataProviderName) { return dataProviderService.getDataProvider(new DataProviderKey(dataProviderName)); }  @RequestMapping(value = "/dataProviders", method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_DATA_PROVIDERS_POST) DataProvider createDataProvider(@RequestBody DataProviderCreateRequest request); @RequestMapping(value = "/dataProviders/{dataProviderName}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_DATA_PROVIDERS_GET) DataProvider getDataProvider(@PathVariable("dataProviderName") String dataProviderName); @RequestMapping(value = "/dataProviders/{dataProviderName}", method = RequestMethod.DELETE) @Secured(SecurityFunctions.FN_DATA_PROVIDERS_DELETE) DataProvider deleteDataProvider(@PathVariable("dataProviderName") String dataProviderName); @RequestMapping(value = "/dataProviders", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_DATA_PROVIDERS_ALL_GET) DataProviderKeys getDataProviders();  }
@Test public void testGetDataProvider() throws Exception { DataProvider dataProvider = new DataProvider(DATA_PROVIDER_NAME); DataProviderKey dataProviderKey = new DataProviderKey(DATA_PROVIDER_NAME); when(dataProviderService.getDataProvider(dataProviderKey)).thenReturn(dataProvider); DataProvider resultDataProvider = dataProviderRestController.getDataProvider(DATA_PROVIDER_NAME); verify(dataProviderService).getDataProvider(dataProviderKey); verifyNoMoreInteractions(dataProviderService); assertEquals(dataProvider, resultDataProvider); }