NamespaceRestController { @RequestMapping(value = "/namespaces", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_NAMESPACES_ALL_GET) public NamespaceKeys getNamespaces() { return namespaceService.getNamespaces(); }  @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 testGetNamespaces() throws Exception { NamespaceKeys namespaceKeys = new NamespaceKeys(Arrays.asList(new NamespaceKey(NAMESPACE), new NamespaceKey(NAMESPACE_2))); when(namespaceService.getNamespaces()).thenReturn(namespaceKeys); NamespaceKeys resultNamespaceKeys = namespaceRestController.getNamespaces(); verify(namespaceService).getNamespaces(); verifyNoMoreInteractions(namespaceService); assertEquals(namespaceKeys, resultNamespaceKeys); }