@Test
public void getAllStream_emitsCurrentValueOnSubscribe() {

    final Map<String, ?> returnedMap = Collections.singletonMap("Test dummy long key", 23453534523L);
    //noinspection unchecked
    when(mockSharedPreferences.getAll()).thenReturn((Map) returnedMap);
    final Disposable subscription = rxPreferences.getAllStream()
            .subscribeOn(testScheduler)
            .subscribe();
    subscriptions.add(subscription);
    verifyGetStreamBeforeSubscribe(subscription);
    advanceScheduler();
    verifyNoMoreInteractions(mockSharedPreferencesEditor);
    verify(mockSharedPreferences).getAll();
    verify(mockSharedPreferences).registerOnSharedPreferenceChangeListener(isA(RxAllPreferencesListener.class));
    verifyNoMoreInteractions(mockSharedPreferences);
    assertFalse(subscription.isDisposed());
}