Skip to content

Commit fefe12d

Browse files
DavidDTAakarnokd
authored andcommitted
Wait until both subscribers have received their values in testPublishLast (ReactiveX#4021)
1 parent 64a3d7e commit fefe12d

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

‎src/test/java/rx/ObservableTests.java‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -498,21 +498,18 @@ public void run() {
498498
}).takeLast(1).publish();
499499

500500
// subscribe once
501-
final CountDownLatch latch = new CountDownLatch(1);
502-
connectable.subscribe(new Action1<String>() {
501+
final CountDownLatch latch = new CountDownLatch(2);
502+
Action1<String> subscriptionAction = new Action1<String>() {
503503
@Override
504504
public void call(String value) {
505505
assertEquals("last", value);
506506
latch.countDown();
507507
}
508-
});
508+
};
509+
connectable.subscribe(subscriptionAction);
509510

510511
// subscribe twice
511-
connectable.subscribe(new Action1<String>() {
512-
@Override
513-
public void call(String ignored) {
514-
}
515-
});
512+
connectable.subscribe(subscriptionAction);
516513

517514
Subscription subscription = connectable.connect();
518515
assertTrue(latch.await(1000, TimeUnit.MILLISECONDS));

0 commit comments

Comments
 (0)