@Test public void shouldSetField() { Mockito.when(databaseReference.child(UserFieldType.USERNAME.key)) .thenReturn(databaseReference); profileRepository.setField(UserFieldType.USERNAME, "test_username"); Mockito.verify(databaseReference).setValue("test_username"); }
public void setField(UserFieldType userFieldType, String profileField) { databaseReference.child(userFieldType.key).setValue(profileField); }
ProfileRepository { public void setField(UserFieldType userFieldType, String profileField) { databaseReference.child(userFieldType.key).setValue(profileField); } }
ProfileRepository { public void setField(UserFieldType userFieldType, String profileField) { databaseReference.child(userFieldType.key).setValue(profileField); } @Inject  ProfileRepository(DatabaseReference databaseReference, FirebaseAuth firebaseAuth); }
ProfileRepository { public void setField(UserFieldType userFieldType, String profileField) { databaseReference.child(userFieldType.key).setValue(profileField); } @Inject  ProfileRepository(DatabaseReference databaseReference, FirebaseAuth firebaseAuth); @NonNull LiveData<DataSnapshot> getUser(); void setUser(User user); void setField(UserFieldType userFieldType, String profileField); }
ProfileRepository { public void setField(UserFieldType userFieldType, String profileField) { databaseReference.child(userFieldType.key).setValue(profileField); } @Inject  ProfileRepository(DatabaseReference databaseReference, FirebaseAuth firebaseAuth); @NonNull LiveData<DataSnapshot> getUser(); void setUser(User user); void setField(UserFieldType userFieldType, String profileField); @VisibleForTesting
    public FirebaseDatabaseLiveData firebaseDatabaseLiveData; public DatabaseReference databaseReference; }