@Test
public void testUpdateUserNamespaceAuthorizationHappyPath()
{

    when(alternateKeyHelper.validateStringParameter("namespace", NAMESPACE_VALUE)).thenReturn(NAMESPACE_VALUE);
    when(alternateKeyHelper.validateStringParameter("user id", USER_ID_VALUE)).thenReturn(USER_ID_VALUE);
    when(currentUserService.getCurrentUser()).thenReturn(USER_AUTHORIZATIONS);
    when(userNamespaceAuthorizationDao.getUserNamespaceAuthorizationByKey(USER_NAMESPACE_AUTHORIZATION_KEY))
        .thenReturn(USER_NAMESPACE_AUTHORIZATION_ENTITY);
    when(userNamespaceAuthorizationHelper.getNamespacePermissions(USER_NAMESPACE_AUTHORIZATION_ENTITY)).thenReturn(NAMESPACE_PERMISSIONS);
    UserNamespaceAuthorization userNamespaceAuthorization =
        userNamespaceAuthorizationService.updateUserNamespaceAuthorization(USER_NAMESPACE_AUTHORIZATION_KEY, USER_NAMESPACE_AUTHORIZATION_UPDATE_REQUEST);
    assertEquals(USER_NAMESPACE_AUTHORIZATION_ID, userNamespaceAuthorization.getId());
    assertEquals(USER_NAMESPACE_AUTHORIZATION_KEY, userNamespaceAuthorization.getUserNamespaceAuthorizationKey());
    assertEquals(NAMESPACE_PERMISSIONS, userNamespaceAuthorization.getNamespacePermissions());
    verify(alternateKeyHelper).validateStringParameter("namespace", NAMESPACE_VALUE);
    verify(alternateKeyHelper).validateStringParameter("user id", USER_ID_VALUE);
    verify(currentUserService).getCurrentUser();
    verify(userNamespaceAuthorizationDao).getUserNamespaceAuthorizationByKey(USER_NAMESPACE_AUTHORIZATION_KEY);
    verify(userNamespaceAuthorizationDao).saveAndRefresh(any(UserNamespaceAuthorizationEntity.class));
    verify(messageNotificationEventService).processUserNamespaceAuthorizationChangeNotificationEvent(USER_NAMESPACE_AUTHORIZATION_KEY);
    verify(userNamespaceAuthorizationHelper).getNamespacePermissions(USER_NAMESPACE_AUTHORIZATION_ENTITY);
    verifyNoMoreInteractionsHelper();
}