Skip to content

Commit

Permalink
Merge pull request #1066 from akarnokd/CompositeSubscriptionFix422
Browse files Browse the repository at this point in the history
CompositeSubscription fix
  • Loading branch information
benjchristensen committed Apr 23, 2014
2 parents f04cd5f + 96b06f9 commit 5d75967
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ State remove(Subscription s) {
for (Subscription _s : subscriptions) {
if (!_s.equals(s)) {
// was not in this composite
if (idx == subscriptions.length) {
if (idx == newSubscriptions.length) {
return this;
}
newSubscriptions[idx] = _s;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,4 +324,17 @@ public void run() {
// we should have only unsubscribed once
assertEquals(1, counter.get());
}
@Test
public void testTryRemoveIfNotIn() {
CompositeSubscription csub = new CompositeSubscription();

CompositeSubscription csub1 = new CompositeSubscription();
CompositeSubscription csub2 = new CompositeSubscription();

csub.add(csub1);
csub.remove(csub1);
csub.add(csub2);

csub.remove(csub1); // try removing agian
}
}

0 comments on commit 5d75967

Please sign in to comment.