### Question:
PasswordAuthenticator implements Authenticator { @Override public User getAuthUser(HttpServletRequest request) { Session session = sessionService.getSession(request); if (session == null) { logger.info("session info is null "); return null; } return userService.queryUser(session.getUserId()); }  @Override Result<Map<String, String>> authenticate(String username, String password, String extra); @Override User getAuthUser(HttpServletRequest request);  }### Answer:
@Test public void testGetAuthUser() { HttpServletRequest request = Mockito.mock(HttpServletRequest.class); when(usersService.queryUser(mockUser.getId())).thenReturn(mockUser); when(sessionService.getSession(request)).thenReturn(mockSession); User user = authenticator.getAuthUser(request); Assert.assertNotNull(user); }