package org.mercury_im.messenger.learning_tests.rx;

import org.junit.Test;

import io.reactivex.Observable;
import io.reactivex.subjects.BehaviorSubject;
import io.reactivex.subjects.Subject;

import static junit.framework.TestCase.assertNotNull;

public class BehaviourSubjectSubscriptionTest {

    @Test
    public void test() throws InterruptedException {
        Observable<String> observable = Observable.just("One", "Two", "Three");
        BehaviorSubject<String> behaviorSubject = BehaviorSubject.create();

        observable.subscribe(behaviorSubject);
        behaviorSubject.subscribe(System.out::println);

        Thread.sleep(100);

        String s = behaviorSubject.getValue();
        assertNotNull(s);
    }
}
