@Test public void getCurrentUser() { Auth auth = new Auth(); FirebaseUser firebaseUser = Mockito.mock(FirebaseUser.class); Mockito.when(firebaseUser.getDisplayName()).thenReturn("display_name"); Mockito.when(firebaseUser.getEmail()).thenReturn("email"); Mockito.when(firebaseUser.getUid()).thenReturn("uid"); Mockito.when(firebaseUser.getProviderId()).thenReturn("provider_id"); Mockito.when(firebaseAuth.getCurrentUser()).thenReturn(firebaseUser); GdxFirebaseUser user = auth.getCurrentUser(); Assert.assertNotNull(user.getUserInfo()); Assert.assertEquals(user.getUserInfo().getDisplayName(), firebaseUser.getDisplayName()); Assert.assertEquals(user.getUserInfo().getEmail(), firebaseUser.getEmail()); Assert.assertEquals(user.getUserInfo().getUid(), firebaseUser.getUid()); Assert.assertEquals(user.getUserInfo().getProviderId(), firebaseUser.getProviderId()); }
@Override public GdxFirebaseUser getCurrentUser() { FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if (user == null) return null; UserInfo.Builder builder = new UserInfo.Builder(); builder.setDisplayName(user.getDisplayName()) .setPhotoUrl(user.getPhotoUrl() != null ? user.getPhotoUrl().getPath() : null) .setProviderId(user.getProviderId()) .setUid(user.getUid()) .setIsEmailVerified(user.isEmailVerified()) .setIsAnonymous(user.isAnonymous()) .setEmail(user.getEmail()); return GdxFirebaseUser.create(builder.build()); }
Auth implements AuthDistribution { @Override public GdxFirebaseUser getCurrentUser() { FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if (user == null) return null; UserInfo.Builder builder = new UserInfo.Builder(); builder.setDisplayName(user.getDisplayName()) .setPhotoUrl(user.getPhotoUrl() != null ? user.getPhotoUrl().getPath() : null) .setProviderId(user.getProviderId()) .setUid(user.getUid()) .setIsEmailVerified(user.isEmailVerified()) .setIsAnonymous(user.isAnonymous()) .setEmail(user.getEmail()); return GdxFirebaseUser.create(builder.build()); } }
Auth implements AuthDistribution { @Override public GdxFirebaseUser getCurrentUser() { FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if (user == null) return null; UserInfo.Builder builder = new UserInfo.Builder(); builder.setDisplayName(user.getDisplayName()) .setPhotoUrl(user.getPhotoUrl() != null ? user.getPhotoUrl().getPath() : null) .setProviderId(user.getProviderId()) .setUid(user.getUid()) .setIsEmailVerified(user.isEmailVerified()) .setIsAnonymous(user.isAnonymous()) .setEmail(user.getEmail()); return GdxFirebaseUser.create(builder.build()); }  }
Auth implements AuthDistribution { @Override public GdxFirebaseUser getCurrentUser() { FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if (user == null) return null; UserInfo.Builder builder = new UserInfo.Builder(); builder.setDisplayName(user.getDisplayName()) .setPhotoUrl(user.getPhotoUrl() != null ? user.getPhotoUrl().getPath() : null) .setProviderId(user.getProviderId()) .setUid(user.getUid()) .setIsEmailVerified(user.isEmailVerified()) .setIsAnonymous(user.isAnonymous()) .setEmail(user.getEmail()); return GdxFirebaseUser.create(builder.build()); }  @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email); }
Auth implements AuthDistribution { @Override public GdxFirebaseUser getCurrentUser() { FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if (user == null) return null; UserInfo.Builder builder = new UserInfo.Builder(); builder.setDisplayName(user.getDisplayName()) .setPhotoUrl(user.getPhotoUrl() != null ? user.getPhotoUrl().getPath() : null) .setProviderId(user.getProviderId()) .setUid(user.getUid()) .setIsEmailVerified(user.isEmailVerified()) .setIsAnonymous(user.isAnonymous()) .setEmail(user.getEmail()); return GdxFirebaseUser.create(builder.build()); }  @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email);  }