title: Unable to mock GAE userservice
body: <p><br>
  I am trying to mock the gae user service for writing unit tests and couldn't get the following code to work. </p>
  
  <p>My test class is as below.</p>
  
  <pre><code>public class AuthenticationTest {
  
      private final LocalServiceTestHelper helper =
          new LocalServiceTestHelper(new LocalUserServiceTestConfig())
              .setEnvIsAdmin(true).setEnvIsLoggedIn(true)
              .setEnvEmail("test@example.com");
  
      @Before
      public void setUp() {
          helper.setUp();
      }
  
      @After
      public void tearDown() {
          helper.tearDown();
      }
  
      @Test
      public void testIsAdmin() {
          UserService userService = UserServiceFactory.getUserService();
          assertTrue(userService.isUserAdmin());
  
          String email = userService.getCurrentUser().getEmail();
          assertEquals(email, "test@example.com");
      }
  }
  </code></pre>
  
  <p>I find that userService.getCurrentUser() always returns null.</p>
  
  <p>Most of the code is taken from the example in <a href="https://developers.google.com/appengine/docs/java/tools/localunittesting#Writing_Tests_with_Authentication_Expectations" rel="nofollow">developers.google.com</a>. The only thing I added is call to .setEnvEmail("test@example.com")</p>
  
  <p>Any help would be appreciated. </p>
  
  <p>Thanks,<br>
  Sathya</p>