SolrTestFrameRunner.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:eHMP 作者:
private void initUserContext() {
    // setup mock user context
    mockTrustResolver = mock(AuthenticationTrustResolver.class);
    mockUser = mock(HmpUserDetails.class, Mockito.withSettings().extraInterfaces(HealthTimePrinterSetHolder.class));
    mockAuthentication = mock(Authentication.class);

    // setup mock authentication context
    SecurityContextHolder.getContext().setAuthentication(mockAuthentication);
    when(mockAuthentication.isAuthenticated()).thenReturn(true);
    when(mockAuthentication.getPrincipal()).thenReturn(mockUser);
    when(mockTrustResolver.isAnonymous(mockAuthentication)).thenReturn(false);

    // create and register
    userContext = new HmpUserContext(mockTrustResolver);
    addResource(userContext);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号