DataProviderRestController { @RequestMapping(value = "/dataProviders", method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_DATA_PROVIDERS_POST) public DataProvider createDataProvider(@RequestBody DataProviderCreateRequest request) { return dataProviderService.createDataProvider(request); }  @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 testCreateDataProvider() throws Exception { DataProviderCreateRequest dataProviderCreateRequest = new DataProviderCreateRequest(DATA_PROVIDER_NAME); DataProvider dataProvider = new DataProvider(DATA_PROVIDER_NAME); when(dataProviderService.createDataProvider(dataProviderCreateRequest)).thenReturn(dataProvider); DataProvider resultDataProvider = dataProviderRestController.createDataProvider(new DataProviderCreateRequest(DATA_PROVIDER_NAME)); assertEquals(new DataProvider(DATA_PROVIDER_NAME), resultDataProvider); verify(dataProviderService).createDataProvider(dataProviderCreateRequest); verifyNoMoreInteractions(dataProviderService); assertEquals(dataProvider, resultDataProvider); }