@Test
public void TestValue() {

    PublishSubject<String> observable = new PublishSubject<>();
    observable.post("1");
    // new observer should NOT get the value
    Disposable subscriptionA = observable.subscribe(new Observer<String>() {
        @Override
        public void onChanged(String value) {
            addResult("A" + value);
        }
    });
    AssertResults();
    // the observer should get the value
    observable.post("2");
    AssertResults("A2");
    // new observer should NOT get current value
    Disposable subscriptionB = observable.subscribe(new Observer<String>() {
        @Override
        public void onChanged(String value) {
            addResult("B" + value);
        }
    });
    AssertResults();
    // new value
    observable.post("3");
    AssertResults("A3", "B3");
    // remove subscription
    subscriptionA.dispose();
    observable.post("4");
    AssertResults("B4");
    // remove subscription
    subscriptionB.dispose();
    observable.post("5");
    AssertResults();
    observable.subscribe(new Observer<String>() {
        @Override
        public void onChanged(String value) {
            addResult("C" + value);
        }
    });
    AssertResults();
    observable.post("6");
    AssertResults("C6");
}