NamespaceRestController { @RequestMapping(value = "/namespaces", method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_NAMESPACES_POST) public Namespace createNamespace(@RequestBody NamespaceCreateRequest request) { return namespaceService.createNamespace(request); }  @RequestMapping(value = "/namespaces", method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_NAMESPACES_POST) Namespace createNamespace(@RequestBody NamespaceCreateRequest request); @RequestMapping(value = "/namespaces/{namespaceCode}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_NAMESPACES_GET) Namespace getNamespace(@PathVariable("namespaceCode") String namespaceCode); @RequestMapping(value = "/namespaces/{namespaceCode}", method = RequestMethod.DELETE) @Secured(SecurityFunctions.FN_NAMESPACES_DELETE) Namespace deleteNamespace(@PathVariable("namespaceCode") String namespaceCode); @RequestMapping(value = "/namespaces", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_NAMESPACES_ALL_GET) NamespaceKeys getNamespaces();  }
@Test public void testCreateNamespace() throws Exception { NamespaceCreateRequest request = namespaceServiceTestHelper.createNamespaceCreateRequest(NAMESPACE); Namespace namespace = new Namespace(NAMESPACE); when(namespaceService.createNamespace(request)).thenReturn(namespace); Namespace resultNamespace = namespaceRestController.createNamespace(request); namespaceServiceTestHelper.validateNamespace(NAMESPACE, resultNamespace); verify(namespaceService).createNamespace(request); verifyNoMoreInteractions(namespaceService); assertEquals(namespace, resultNamespace); }