NamespaceRestController { @RequestMapping(value = "/namespaces/{namespaceCode}", method = RequestMethod.DELETE) @Secured(SecurityFunctions.FN_NAMESPACES_DELETE) public Namespace deleteNamespace(@PathVariable("namespaceCode") String namespaceCode) { return namespaceService.deleteNamespace(new NamespaceKey(namespaceCode)); }  @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 testDeleteNamespace() throws Exception { Namespace namespace = new Namespace(NAMESPACE); when(namespaceService.deleteNamespace(new NamespaceKey(NAMESPACE))).thenReturn(namespace); Namespace deletedNamespace = namespaceRestController.deleteNamespace(NAMESPACE); verify(namespaceService).deleteNamespace(new NamespaceKey(NAMESPACE)); verifyNoMoreInteractions(namespaceService); assertEquals(namespace, deletedNamespace); }