SecurityFunctionRestController { @RequestMapping(value = SECURITY_FUNCTIONS_URI_PREFIX + "/{securityFunctionName}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_SECURITY_FUNCTIONS_GET) public SecurityFunction getSecurityFunction(@PathVariable("securityFunctionName") String securityFunctionName) { return securityFunctionService.getSecurityFunction(new SecurityFunctionKey(securityFunctionName)); }  @RequestMapping(value = SECURITY_FUNCTIONS_URI_PREFIX, method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_SECURITY_FUNCTIONS_POST) SecurityFunction createSecurityFunction(@RequestBody SecurityFunctionCreateRequest request); @RequestMapping(value = SECURITY_FUNCTIONS_URI_PREFIX + "/{securityFunctionName}", method = RequestMethod.DELETE) @Secured(SecurityFunctions.FN_SECURITY_FUNCTIONS_DELETE) SecurityFunction deleteSecurityFunction(@PathVariable("securityFunctionName") String securityFunctionName); @RequestMapping(value = SECURITY_FUNCTIONS_URI_PREFIX + "/{securityFunctionName}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_SECURITY_FUNCTIONS_GET) SecurityFunction getSecurityFunction(@PathVariable("securityFunctionName") String securityFunctionName); @RequestMapping(value = SECURITY_FUNCTIONS_URI_PREFIX, method = RequestMethod.GET) @Secured(SecurityFunctions.FN_SECURITY_FUNCTIONS_ALL_GET) SecurityFunctionKeys getSecurityFunctions();  }
@Test public void testGetSecurityFunction() throws Exception { SecurityFunction securityFunction = new SecurityFunction(SECURITY_FUNCTION); when(securityFunctionService.getSecurityFunction(new SecurityFunctionKey(SECURITY_FUNCTION))).thenReturn(securityFunction); SecurityFunction resultSecurityFunction = securityFunctionRestController.getSecurityFunction(SECURITY_FUNCTION); verify(securityFunctionService).getSecurityFunction(new SecurityFunctionKey(SECURITY_FUNCTION)); verifyNoMoreInteractions(securityFunctionService); assertEquals(securityFunction, resultSecurityFunction); }