Created
July 14, 2015 11:45
-
-
Save kinjouj/1bfe48dae9b8707c5710 to your computer and use it in GitHub Desktop.
CompositeSubscription test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rx.subscriptions.BooleanSubscription; | |
import rx.subscriptions.CompositeSubscription; | |
import org.junit.Before; | |
import org.junit.Test; | |
import static org.junit.Assert.assertThat; | |
import static org.hamcrest.Matchers.*; | |
public class CompositeSubscriptionTest { | |
private CompositeSubscription subscriptions; | |
@Before | |
public void setUp() { | |
subscriptions = new CompositeSubscription(); | |
subscriptions.add(new BooleanSubscription()); | |
} | |
@Test | |
public void test_unsubscribe() { | |
assertThat(subscriptions.hasSubscriptions(), is(true)); | |
subscriptions.unsubscribe(); | |
assertThat(subscriptions.hasSubscriptions(), is(false)); | |
subscriptions.add(new BooleanSubscription()); | |
// java.lang.AssertionError | |
assertThat(subscriptions.hasSubscriptions(), is(true)); | |
} | |
@Test | |
public void test_clear() { | |
assertThat(subscriptions.hasSubscriptions(), is(true)); | |
subscriptions.clear(); | |
assertThat(subscriptions.hasSubscriptions(), is(false)); | |
subscriptions.add(new BooleanSubscription()); | |
assertThat(subscriptions.hasSubscriptions(), is(true)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment