@Test
public void testDoFilterWithLoginAliasInUri() throws Exception {

  // Given
  expect(userRelatedRequest.getRequestURI()).andReturn(String.format("/test/users/%s/test1", URLEncoder.encode("testLoginAlias@testdomain.com", "UTF-8"))).anyTimes();
  Capture<ServletRequest> requestCapture = Capture.newInstance();
  filterChain.doFilter(capture(requestCapture), same(response));
  expectLastCall();
  PowerMock.mockStatic(AuthorizationHelper.class);
  expect(AuthorizationHelper.resolveLoginAliasToUserName(eq("testLoginAlias@testdomain.com"))).andReturn("testuser1");
  PowerMock.replay(AuthorizationHelper.class);
  replayAll();
  // When
  filter.doFilter(userRelatedRequest, response, filterChain);
  // Then
  HttpServletRequest updatedRequest = (HttpServletRequest)requestCapture.getValue();
  assertEquals("testLoginAlias@testdomain.com login alias in the request Uri should be resolved to testuser1 user name !", "/test/users/testuser1/test1", updatedRequest.getRequestURI());
  PowerMock.verify(AuthorizationHelper.class);
  verifyAll();
}