We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b765b23 commit 1d5991cCopy full SHA for 1d5991c
rxjava-core/src/test/java/rx/subscriptions/CompositeSubscriptionTest.java
@@ -124,4 +124,24 @@ public void testClear() {
124
assertTrue(s3.isUnsubscribed());
125
assertTrue(s.isUnsubscribed());
126
}
127
+
128
+ @Test
129
+ public void testUnsubscribeIdempotence() {
130
+ final AtomicInteger counter = new AtomicInteger();
131
+ CompositeSubscription s = new CompositeSubscription();
132
+ s.add(new Subscription() {
133
134
+ @Override
135
+ public void unsubscribe() {
136
+ counter.incrementAndGet();
137
+ }
138
+ });
139
140
+ s.unsubscribe();
141
142
143
144
+ // we should have only unsubscribed once
145
+ assertEquals(1, counter.get());
146
147
0 commit comments