@Test
public void testAuthenticate_appEngineUser() throws ServiceUnavailableException {

  attr.set(Attribute.REQUIRE_APPENGINE_USER, true);
  when(config.getScopeExpression()).thenReturn(AuthScopeExpressions.interpret("scope1"));
  when(config.getClientIds()).thenReturn(ImmutableList.of(CLIENT_ID));
  User user = authenticator.authenticate(request);
  assertEquals(EMAIL, user.getEmail());
  assertEquals(USER_ID, user.getId());
  com.google.appengine.api.users.User appEngineuser =
      (com.google.appengine.api.users.User) attr.get(Attribute.AUTHENTICATED_APPENGINE_USER);
  assertEquals(EMAIL, appEngineuser.getEmail());
  assertNull(appEngineuser.getUserId());
}