@Test
public void containsStream_emitsCurrentValueOnSubscribe() {

    final String testKey = "Test contains key";
    when(mockSharedPreferences.contains(testKey)).thenReturn(true);
    final Disposable subscription = rxPreferences.containsStream(testKey)
            .subscribeOn(testScheduler)
            .subscribe();
    subscriptions.add(subscription);
    verifyGetStreamBeforeSubscribe(subscription);
    advanceScheduler();
    // After subscribing, the value is retrieved from the internal preferences:
    verify(mockSharedPreferences).contains(testKey);
    verify(mockSharedPreferences).registerOnSharedPreferenceChangeListener(isA(RxPreferenceContainsListener.class));
    verifyNoMoreInteractions(mockSharedPreferences);
    assertFalse(subscription.isDisposed());
}