Package org.ngrinder.user.service

Examples of org.ngrinder.user.service.MockUserContext


    // test2 scenario: admin can check other user's script
    // has parameter "ownerId", and current user is Admin, resolved user is "TEST2_USER"
    ServletWebRequest webRequest2 = mock(ServletWebRequest.class);
    when(webRequest2.getParameter("ownerId")).thenReturn("TEST2_USER");
    User adminUser = new User("tmpAdminId", "tmpAdminId", "tmpAdminPwd", "admin@nhn.com", Role.ADMIN);
    MockUserContext adminUserContext = mock(MockUserContext.class);
    when(adminUserContext.getCurrentUser()).thenReturn(adminUser);
    resolver.setUserContext(adminUserContext);
    Object resolveArgument2 = resolver.resolveArgument(parameter, null, webRequest2, null);
    assertThat(((User) resolveArgument2).getUserId(), is("TEST2_USER"));

    // test3 scenario: general user switch to use other's permission
View Full Code Here

TOP

Related Classes of org.ngrinder.user.service.MockUserContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.