UserNamespaceAuthorizationRestController extends HerdBaseController { @RequestMapping(value = USER_NAMESPACE_AUTHORIZATIONS_URI_PREFIX + "/userIds/{userId}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_USER_NAMESPACE_AUTHORIZATIONS_BY_USERID_GET) public UserNamespaceAuthorizations getUserNamespaceAuthorizationsByUserId(@PathVariable("userId") String userId) { return userNamespaceAuthorizationService.getUserNamespaceAuthorizationsByUserId(userId); }  @RequestMapping(value = USER_NAMESPACE_AUTHORIZATIONS_URI_PREFIX, method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_USER_NAMESPACE_AUTHORIZATIONS_POST) UserNamespaceAuthorization createUserNamespaceAuthorization(@RequestBody UserNamespaceAuthorizationCreateRequest request); @RequestMapping(value = USER_NAMESPACE_AUTHORIZATIONS_URI_PREFIX + "/userIds/{userId}/namespaces/{namespace}", method = RequestMethod.PUT, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_USER_NAMESPACE_AUTHORIZATIONS_PUT) UserNamespaceAuthorization updateUserNamespaceAuthorization(@PathVariable("userId") String userId, @PathVariable("namespace") String namespace,
        @RequestBody UserNamespaceAuthorizationUpdateRequest request); @RequestMapping(value = USER_NAMESPACE_AUTHORIZATIONS_URI_PREFIX + "/userIds/{userId}/namespaces/{namespace}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_USER_NAMESPACE_AUTHORIZATIONS_GET) UserNamespaceAuthorization getUserNamespaceAuthorization(@PathVariable("userId") String userId, @PathVariable("namespace") String namespace); @RequestMapping(value = USER_NAMESPACE_AUTHORIZATIONS_URI_PREFIX + "/userIds/{userId}/namespaces/{namespace}", method = RequestMethod.DELETE) @Secured(SecurityFunctions.FN_USER_NAMESPACE_AUTHORIZATIONS_DELETE) UserNamespaceAuthorization deleteUserNamespaceAuthorization(@PathVariable("userId") String userId, @PathVariable("namespace") String namespace); @RequestMapping(value = USER_NAMESPACE_AUTHORIZATIONS_URI_PREFIX + "/userIds/{userId}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_USER_NAMESPACE_AUTHORIZATIONS_BY_USERID_GET) UserNamespaceAuthorizations getUserNamespaceAuthorizationsByUserId(@PathVariable("userId") String userId); @RequestMapping(value = USER_NAMESPACE_AUTHORIZATIONS_URI_PREFIX + "/namespaces/{namespace}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_USER_NAMESPACE_AUTHORIZATIONS_BY_NAMESPACE_GET) UserNamespaceAuthorizations getUserNamespaceAuthorizationsByNamespace(@PathVariable("namespace") String namespace); static final String USER_NAMESPACE_AUTHORIZATIONS_URI_PREFIX; }
@Test public void testGetUserNamespaceAuthorizationsByUserId() throws Exception { UserNamespaceAuthorizations userNamespaceAuthorizations = new UserNamespaceAuthorizations(); when(userNamespaceAuthorizationService.getUserNamespaceAuthorizationsByUserId(USER_ID)).thenReturn(userNamespaceAuthorizations); UserNamespaceAuthorizations resultUserNamespaceAuthorizations = userNamespaceAuthorizationRestController.getUserNamespaceAuthorizationsByUserId(USER_ID); verify(userNamespaceAuthorizationService).getUserNamespaceAuthorizationsByUserId(USER_ID); verifyNoMoreInteractions(userNamespaceAuthorizationService); assertEquals(resultUserNamespaceAuthorizations, userNamespaceAuthorizations); }