From 0336aa48d1c87dd36c1cdf1f08068a7119078517 Mon Sep 17 00:00:00 2001 From: Dmitry Volkov Date: Sun, 22 Dec 2019 12:30:09 +0300 Subject: [PATCH] diamond operators in unit tests, flowable package --- .../flowable/BlockingFlowableNextTest.java | 6 +- .../BlockingFlowableToIteratorTest.java | 8 +- .../operators/flowable/FlowableAllTest.java | 10 +- .../operators/flowable/FlowableAmbTest.java | 20 ++-- .../operators/flowable/FlowableAnyTest.java | 10 +- .../flowable/FlowableBlockingTest.java | 38 ++++---- .../flowable/FlowableBufferTest.java | 89 ++++++++--------- .../operators/flowable/FlowableCacheTest.java | 40 ++++---- .../flowable/FlowableCombineLatestTest.java | 18 ++-- .../FlowableConcatDelayErrorTest.java | 4 +- .../flowable/FlowableConcatMapEagerTest.java | 12 +-- .../FlowableConcatMapSchedulerTest.java | 2 +- .../flowable/FlowableConcatMapTest.java | 4 +- .../flowable/FlowableConcatTest.java | 52 +++++----- .../FlowableConcatWithCompletableTest.java | 8 +- .../flowable/FlowableConcatWithMaybeTest.java | 10 +- .../FlowableConcatWithSingleTest.java | 8 +- .../flowable/FlowableCreateTest.java | 2 +- .../flowable/FlowableDebounceTest.java | 20 ++-- .../flowable/FlowableDefaultIfEmptyTest.java | 4 +- .../FlowableDelaySubscriptionOtherTest.java | 16 ++-- .../operators/flowable/FlowableDelayTest.java | 28 +++--- .../flowable/FlowableDematerializeTest.java | 2 +- .../flowable/FlowableDetachTest.java | 22 ++--- .../flowable/FlowableDoAfterNextTest.java | 2 +- .../FlowableDoAfterTerminateTest.java | 2 +- .../flowable/FlowableDoFinallyTest.java | 4 +- .../flowable/FlowableDoOnEachTest.java | 14 +-- .../flowable/FlowableDoOnRequestTest.java | 2 +- .../flowable/FlowableDoOnSubscribeTest.java | 2 +- .../flowable/FlowableDoOnUnsubscribeTest.java | 12 +-- .../flowable/FlowableElementAtTest.java | 4 +- .../flowable/FlowableFilterTest.java | 2 +- .../flowable/FlowableFlatMapMaybeTest.java | 2 +- .../flowable/FlowableFlatMapSingleTest.java | 2 +- .../flowable/FlowableFlatMapTest.java | 18 ++-- .../flowable/FlowableFlattenIterableTest.java | 58 +++++------ .../flowable/FlowableForEachTest.java | 4 +- .../flowable/FlowableFromArrayTest.java | 2 +- .../flowable/FlowableFromCallableTest.java | 4 +- .../flowable/FlowableFromIterableTest.java | 38 ++++---- .../flowable/FlowableFromSourceTest.java | 2 +- .../flowable/FlowableFromSupplierTest.java | 4 +- .../flowable/FlowableGroupByTest.java | 95 ++++++++++--------- .../flowable/FlowableIgnoreElementsTest.java | 8 +- .../flowable/FlowableIntervalTest.java | 2 +- .../flowable/FlowableMapNotificationTest.java | 6 +- .../operators/flowable/FlowableMapTest.java | 6 +- .../flowable/FlowableMaterializeTest.java | 16 ++-- .../flowable/FlowableMergeDelayErrorTest.java | 14 +-- .../FlowableMergeMaxConcurrentTest.java | 48 +++++----- .../operators/flowable/FlowableMergeTest.java | 68 ++++++------- .../FlowableMergeWithCompletableTest.java | 4 +- .../flowable/FlowableMergeWithMaybeTest.java | 4 +- .../flowable/FlowableMergeWithSingleTest.java | 6 +- .../flowable/FlowableObserveOnTest.java | 30 +++--- ...wableOnBackpressureBufferStrategyTest.java | 2 +- .../FlowableOnBackpressureBufferTest.java | 12 ++- .../FlowableOnBackpressureDropTest.java | 6 +- .../FlowableOnBackpressureErrorTest.java | 4 +- .../FlowableOnBackpressureLatestTest.java | 8 +- ...wableOnErrorResumeNextViaFlowableTest.java | 2 +- ...wableOnErrorResumeNextViaFunctionTest.java | 8 +- .../flowable/FlowableOnErrorReturnTest.java | 8 +- .../flowable/FlowablePublishFunctionTest.java | 12 +-- .../FlowablePublishMulticastTest.java | 38 ++++---- .../flowable/FlowablePublishTest.java | 66 ++++++------- .../flowable/FlowableRangeLongTest.java | 22 ++--- .../operators/flowable/FlowableRangeTest.java | 22 ++--- .../flowable/FlowableRefCountTest.java | 22 ++--- .../flowable/FlowableRepeatTest.java | 6 +- .../FlowableReplayEagerTruncateTest.java | 88 ++++++++--------- .../flowable/FlowableReplayTest.java | 88 ++++++++--------- .../operators/flowable/FlowableRetryTest.java | 30 +++--- .../FlowableRetryWithPredicateTest.java | 14 +-- .../flowable/FlowableScalarXMapTest.java | 24 ++--- .../operators/flowable/FlowableScanTest.java | 16 ++-- .../flowable/FlowableSequenceEqualTest.java | 4 +- .../flowable/FlowableSingleTest.java | 8 +- .../flowable/FlowableSkipLastTest.java | 2 +- .../operators/flowable/FlowableSkipTest.java | 4 +- .../flowable/FlowableSubscribeOnTest.java | 14 +-- .../flowable/FlowableSwitchIfEmptyTest.java | 8 +- .../flowable/FlowableSwitchTest.java | 18 ++-- .../flowable/FlowableTakeLastOneTest.java | 10 +- .../flowable/FlowableTakeLastTest.java | 6 +- .../flowable/FlowableTakeLastTimedTest.java | 2 +- .../operators/flowable/FlowableTakeTest.java | 12 +-- .../operators/flowable/FlowableTakeTest2.java | 2 +- .../FlowableTakeUntilPredicateTest.java | 4 +- .../flowable/FlowableTakeUntilTest.java | 8 +- .../flowable/FlowableTakeWhileTest.java | 6 +- .../flowable/FlowableTimeIntervalTest.java | 6 +- .../flowable/FlowableTimeoutTests.java | 26 ++--- .../FlowableTimeoutWithSelectorTest.java | 2 +- .../operators/flowable/FlowableTimerTest.java | 18 ++-- .../flowable/FlowableTimestampTest.java | 12 +-- .../flowable/FlowableToCompletableTest.java | 2 +- .../flowable/FlowableToFutureTest.java | 20 ++-- .../flowable/FlowableToListTest.java | 2 +- .../operators/flowable/FlowableToMapTest.java | 24 ++--- .../flowable/FlowableToMultimapTest.java | 60 ++++++------ .../flowable/FlowableToSortedListTest.java | 2 +- .../flowable/FlowableUnsubscribeOnTest.java | 8 +- .../operators/flowable/FlowableUsingTest.java | 12 +-- .../FlowableWindowWithFlowableTest.java | 32 +++---- .../flowable/FlowableWindowWithSizeTest.java | 22 ++--- ...lowableWindowWithStartEndFlowableTest.java | 14 +-- .../flowable/FlowableWindowWithTimeTest.java | 26 ++--- .../flowable/FlowableWithLatestFromTest.java | 50 +++++----- .../operators/flowable/FlowableZipTest.java | 30 +++--- 111 files changed, 948 insertions(+), 944 deletions(-) diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableNextTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableNextTest.java index 8bc31fa85e..35c1501ae0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableNextTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableNextTest.java @@ -352,7 +352,7 @@ public void interrupt() { @Test public void nextObserverError() { - NextSubscriber no = new NextSubscriber(); + NextSubscriber no = new NextSubscriber<>(); List errors = TestHelper.trackPluginErrors(); try { @@ -366,7 +366,7 @@ public void nextObserverError() { @Test public void nextObserverOnNext() throws Exception { - NextSubscriber no = new NextSubscriber(); + NextSubscriber no = new NextSubscriber<>(); no.setWaiting(); no.onNext(Notification.createOnNext(1)); @@ -379,7 +379,7 @@ public void nextObserverOnNext() throws Exception { @Test public void nextObserverOnCompleteOnNext() throws Exception { - NextSubscriber no = new NextSubscriber(); + NextSubscriber no = new NextSubscriber<>(); no.setWaiting(); no.onNext(Notification.createOnComplete()); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableToIteratorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableToIteratorTest.java index 20bfcf9962..64b22b1785 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableToIteratorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableToIteratorTest.java @@ -117,13 +117,13 @@ public void remove() { @Test(expected = UnsupportedOperationException.class) public void remove() { - BlockingFlowableIterator it = new BlockingFlowableIterator(128); + BlockingFlowableIterator it = new BlockingFlowableIterator<>(128); it.remove(); } @Test public void dispose() { - BlockingFlowableIterator it = new BlockingFlowableIterator(128); + BlockingFlowableIterator it = new BlockingFlowableIterator<>(128); assertFalse(it.isDisposed()); @@ -134,7 +134,7 @@ public void dispose() { @Test public void interruptWait() { - BlockingFlowableIterator it = new BlockingFlowableIterator(128); + BlockingFlowableIterator it = new BlockingFlowableIterator<>(128); try { Thread.currentThread().interrupt(); @@ -147,7 +147,7 @@ public void interruptWait() { @Test(expected = NoSuchElementException.class) public void emptyThrowsNoSuch() { - BlockingFlowableIterator it = new BlockingFlowableIterator(128); + BlockingFlowableIterator it = new BlockingFlowableIterator<>(128); it.onComplete(); it.next(); } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAllTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAllTest.java index 7515b66cb0..387a2017dd 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAllTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAllTest.java @@ -146,7 +146,7 @@ public Publisher apply(Boolean t1) { @Test public void backpressureIfOneRequestedOneShouldBeDelivered() { - TestObserverEx to = new TestObserverEx(); + TestObserverEx to = new TestObserverEx<>(); Flowable.empty().all(new Predicate() { @Override @@ -164,7 +164,7 @@ public boolean test(Object t) { @Test public void predicateThrowsExceptionAndValueInCauseMessage() { - TestObserverEx to = new TestObserverEx(); + TestObserverEx to = new TestObserverEx<>(); final IllegalArgumentException ex = new IllegalArgumentException(); @@ -306,7 +306,7 @@ public Publisher apply(Boolean t1) { @Test public void backpressureIfNoneRequestedNoneShouldBeDeliveredFlowable() { - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); Flowable.empty().all(new Predicate() { @Override public boolean test(Object t1) { @@ -323,7 +323,7 @@ public boolean test(Object t1) { @Test public void backpressureIfOneRequestedOneShouldBeDeliveredFlowable() { - TestSubscriberEx ts = new TestSubscriberEx(1L); + TestSubscriberEx ts = new TestSubscriberEx<>(1L); Flowable.empty().all(new Predicate() { @Override @@ -343,7 +343,7 @@ public boolean test(Object t) { @Test public void predicateThrowsExceptionAndValueInCauseMessageFlowable() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); final IllegalArgumentException ex = new IllegalArgumentException(); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAmbTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAmbTest.java index 72073f3150..42cba044db 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAmbTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAmbTest.java @@ -174,7 +174,7 @@ public void amb3() { @SuppressWarnings("unchecked") @Test public void producerRequestThroughAmb() { - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); ts.request(3); final AtomicLong requested1 = new AtomicLong(); final AtomicLong requested2 = new AtomicLong(); @@ -225,7 +225,7 @@ public void cancel() { @Test public void backpressure() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(0, Flowable.bufferSize() * 2) .ambWith(Flowable.range(0, Flowable.bufferSize() * 2)) .observeOn(Schedulers.computation()) // observeOn has a backpressured RxRingBuffer @@ -254,7 +254,7 @@ public void accept(Subscription s) { //this stream emits second Flowable f2 = Flowable.just(1).doOnSubscribe(incrementer) .delay(100, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.computation()); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.ambArray(f1, f2).subscribe(ts); ts.request(1); ts.awaitDone(5, TimeUnit.SECONDS); @@ -271,7 +271,7 @@ public void secondaryRequestsPropagatedToChildren() throws InterruptedException //this stream emits second Flowable f2 = Flowable.fromArray(4, 5, 6) .delay(200, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.computation()); - TestSubscriber ts = new TestSubscriber(1L); + TestSubscriber ts = new TestSubscriber<>(1L); Flowable.ambArray(f1, f2).subscribe(ts); // before first emission request 20 more @@ -309,7 +309,7 @@ public void ambCancelsOthers() { PublishProcessor source2 = PublishProcessor.create(); PublishProcessor source3 = PublishProcessor.create(); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.ambArray(source1, source2, source3).subscribe(ts); @@ -327,8 +327,8 @@ public void ambCancelsOthers() { @Test public void multipleUse() { - TestSubscriber ts1 = new TestSubscriber(); - TestSubscriber ts2 = new TestSubscriber(); + TestSubscriber ts1 = new TestSubscriber<>(); + TestSubscriber ts2 = new TestSubscriber<>(); Flowable amb = Flowable.timer(100, TimeUnit.MILLISECONDS).ambWith(Flowable.timer(200, TimeUnit.MILLISECONDS)); @@ -541,7 +541,7 @@ public void nullIterableElement() { @Test public void iteratorThrows() { - Flowable.amb(new CrashingMappedIterable>(1, 100, 100, new Function>() { + Flowable.amb(new CrashingMappedIterable<>(1, 100, 100, new Function>() { @Override public Flowable apply(Integer v) throws Exception { return Flowable.never(); @@ -550,7 +550,7 @@ public Flowable apply(Integer v) throws Exception { .to(TestHelper.testConsumer()) .assertFailureAndMessage(TestException.class, "iterator()"); - Flowable.amb(new CrashingMappedIterable>(100, 1, 100, new Function>() { + Flowable.amb(new CrashingMappedIterable<>(100, 1, 100, new Function>() { @Override public Flowable apply(Integer v) throws Exception { return Flowable.never(); @@ -559,7 +559,7 @@ public Flowable apply(Integer v) throws Exception { .to(TestHelper.testConsumer()) .assertFailureAndMessage(TestException.class, "hasNext()"); - Flowable.amb(new CrashingMappedIterable>(100, 100, 1, new Function>() { + Flowable.amb(new CrashingMappedIterable<>(100, 100, 1, new Function>() { @Override public Flowable apply(Integer v) throws Exception { return Flowable.never(); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAnyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAnyTest.java index 936d74f5e0..e121cbc924 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAnyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableAnyTest.java @@ -239,7 +239,7 @@ public Publisher apply(Boolean t1) { @Test public void backpressureIfOneRequestedOneShouldBeDelivered() { - TestObserverEx to = new TestObserverEx(); + TestObserverEx to = new TestObserverEx<>(); Flowable.just(1).any(new Predicate() { @Override public boolean test(Integer v) { @@ -255,7 +255,7 @@ public boolean test(Integer v) { @Test public void predicateThrowsExceptionAndValueInCauseMessage() { - TestObserverEx to = new TestObserverEx(); + TestObserverEx to = new TestObserverEx<>(); final IllegalArgumentException ex = new IllegalArgumentException(); Flowable.just("Boo!").any(new Predicate() { @@ -488,7 +488,7 @@ public Publisher apply(Boolean t1) { @Test public void backpressureIfNoneRequestedNoneShouldBeDeliveredFlowable() { - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); Flowable.just(1).any(new Predicate() { @Override @@ -505,7 +505,7 @@ public boolean test(Integer t) { @Test public void backpressureIfOneRequestedOneShouldBeDeliveredFlowable() { - TestSubscriberEx ts = new TestSubscriberEx(1L); + TestSubscriberEx ts = new TestSubscriberEx<>(1L); Flowable.just(1).any(new Predicate() { @Override public boolean test(Integer v) { @@ -521,7 +521,7 @@ public boolean test(Integer v) { @Test public void predicateThrowsExceptionAndValueInCauseMessageFlowable() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); final IllegalArgumentException ex = new IllegalArgumentException(); Flowable.just("Boo!").any(new Predicate() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBlockingTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBlockingTest.java index cb767ef718..db560e0327 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBlockingTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBlockingTest.java @@ -49,7 +49,7 @@ public void blockingFirstDefault() { @Test public void blockingSubscribeConsumer() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); Flowable.range(1, 5) .subscribeOn(Schedulers.computation()) @@ -65,7 +65,7 @@ public void accept(Integer v) throws Exception { @Test public void boundedBlockingSubscribeConsumer() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); Flowable.range(1, 5) .subscribeOn(Schedulers.computation()) @@ -81,7 +81,7 @@ public void accept(Integer v) throws Exception { @Test public void boundedBlockingSubscribeConsumerBufferExceed() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); Flowable.range(1, 5) .subscribeOn(Schedulers.computation()) @@ -97,7 +97,7 @@ public void accept(Integer v) throws Exception { @Test public void blockingSubscribeConsumerConsumer() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); Flowable.range(1, 5) .subscribeOn(Schedulers.computation()) @@ -113,7 +113,7 @@ public void accept(Integer v) throws Exception { @Test public void boundedBlockingSubscribeConsumerConsumer() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); Flowable.range(1, 5) .subscribeOn(Schedulers.computation()) @@ -129,7 +129,7 @@ public void accept(Integer v) throws Exception { @Test public void boundedBlockingSubscribeConsumerConsumerBufferExceed() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); Flowable.range(1, 5) .subscribeOn(Schedulers.computation()) @@ -145,7 +145,7 @@ public void accept(Integer v) throws Exception { @Test public void blockingSubscribeConsumerConsumerError() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); TestException ex = new TestException(); @@ -165,7 +165,7 @@ public void accept(Object v) throws Exception { @Test public void boundedBlockingSubscribeConsumerConsumerError() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); TestException ex = new TestException(); @@ -185,7 +185,7 @@ public void accept(Object v) throws Exception { @Test public void blockingSubscribeConsumerConsumerAction() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); Consumer cons = new Consumer() { @Override @@ -208,7 +208,7 @@ public void run() throws Exception { @Test public void boundedBlockingSubscribeConsumerConsumerAction() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); Consumer cons = new Consumer() { @Override @@ -233,7 +233,7 @@ public void run() throws Exception { @Test public void boundedBlockingSubscribeConsumerConsumerActionBufferExceed() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); Consumer cons = new Consumer() { @Override @@ -258,7 +258,7 @@ public void run() throws Exception { @Test public void boundedBlockingSubscribeConsumerConsumerActionBufferExceedMillionItem() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); Consumer cons = new Consumer() { @Override @@ -283,7 +283,7 @@ public void run() throws Exception { @Test public void blockingSubscribeObserver() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); Flowable.range(1, 5) .subscribeOn(Schedulers.computation()) @@ -316,7 +316,7 @@ public void onComplete() { @Test public void blockingSubscribeObserverError() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); final TestException ex = new TestException(); @@ -430,7 +430,7 @@ public void subscribe(Subscriber s) { @Test public void interrupt() { - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); Thread.currentThread().interrupt(); @@ -451,7 +451,7 @@ public void blockingSingleEmpty() { @Test public void onCompleteDelayed() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.empty().delay(100, TimeUnit.MILLISECONDS) .blockingSubscribe(ts); @@ -466,7 +466,7 @@ public void utilityClass() { @Test public void disposeUpFront() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); ts.cancel(); Flowable.just(1).blockingSubscribe(ts); @@ -476,7 +476,7 @@ public void disposeUpFront() { @SuppressWarnings("rawtypes") @Test public void delayed() throws Exception { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); final Subscriber[] s = { null }; Schedulers.single().scheduleDirect(new Runnable() { @@ -506,7 +506,7 @@ protected void subscribeActual(Subscriber subscriber) { @Test public void blockinsSubscribeCancelAsync() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); final PublishProcessor pp = PublishProcessor.create(); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferTest.java index 781de93fb0..707d98e0d4 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBufferTest.java @@ -272,7 +272,7 @@ public void accept(List t1) { } private List list(String... args) { - List list = new ArrayList(); + List list = new ArrayList<>(); for (String arg : args) { list.add(arg); } @@ -302,7 +302,7 @@ public void bufferStopsWhenUnsubscribed1() { Flowable source = Flowable.never(); Subscriber> subscriber = TestHelper.mockSubscriber(); - TestSubscriber> ts = new TestSubscriber>(subscriber, 0L); + TestSubscriber> ts = new TestSubscriber<>(subscriber, 0L); source.buffer(100, 200, TimeUnit.MILLISECONDS, scheduler) .doOnNext(new Consumer>() { @@ -730,7 +730,7 @@ public Flowable apply(Integer t1) { @Test public void producerRequestThroughBufferWithSize1() { - TestSubscriber> ts = new TestSubscriber>(3L); + TestSubscriber> ts = new TestSubscriber<>(3L); final AtomicLong requested = new AtomicLong(); Flowable.unsafeCreate(new Publisher() { @@ -761,7 +761,7 @@ public void cancel() { @Test public void producerRequestThroughBufferWithSize2() { - TestSubscriber> ts = new TestSubscriber>(); + TestSubscriber> ts = new TestSubscriber<>(); final AtomicLong requested = new AtomicLong(); Flowable.unsafeCreate(new Publisher() { @@ -789,7 +789,7 @@ public void cancel() { @Test public void producerRequestThroughBufferWithSize3() { - TestSubscriber> ts = new TestSubscriber>(3L); + TestSubscriber> ts = new TestSubscriber<>(3L); final AtomicLong requested = new AtomicLong(); Flowable.unsafeCreate(new Publisher() { @@ -818,7 +818,7 @@ public void cancel() { @Test public void producerRequestThroughBufferWithSize4() { - TestSubscriber> ts = new TestSubscriber>(); + TestSubscriber> ts = new TestSubscriber<>(); final AtomicLong requested = new AtomicLong(); Flowable.unsafeCreate(new Publisher() { @@ -845,7 +845,7 @@ public void cancel() { @Test public void producerRequestOverflowThroughBufferWithSize1() { - TestSubscriber> ts = new TestSubscriber>(Long.MAX_VALUE >> 1); + TestSubscriber> ts = new TestSubscriber<>(Long.MAX_VALUE >> 1); final AtomicLong requested = new AtomicLong(); @@ -874,7 +874,7 @@ public void cancel() { @Test public void producerRequestOverflowThroughBufferWithSize2() { - TestSubscriber> ts = new TestSubscriber>(Long.MAX_VALUE >> 1); + TestSubscriber> ts = new TestSubscriber<>(Long.MAX_VALUE >> 1); final AtomicLong requested = new AtomicLong(); @@ -1249,7 +1249,7 @@ public void bufferBoundaryHint() { } static HashSet set(Integer... values) { - return new HashSet(Arrays.asList(values)); + return new HashSet<>(Arrays.asList(values)); } @SuppressWarnings("unchecked") @@ -1259,7 +1259,7 @@ public void bufferIntoCustomCollection() { .buffer(3, new Supplier>() { @Override public Collection get() throws Exception { - return new HashSet(); + return new HashSet<>(); } }) .test() @@ -1273,7 +1273,7 @@ public void bufferSkipIntoCustomCollection() { .buffer(3, 3, new Supplier>() { @Override public Collection get() throws Exception { - return new HashSet(); + return new HashSet<>(); } }) .test() @@ -1317,7 +1317,7 @@ public Collection get() throws Exception { if (count++ == 1) { return null; } else { - return new ArrayList(); + return new ArrayList<>(); } } }, false) @@ -1337,7 +1337,7 @@ public Collection get() throws Exception { if (count++ == 1) { return null; } else { - return new ArrayList(); + return new ArrayList<>(); } } }, false) @@ -1357,7 +1357,7 @@ public Collection get() throws Exception { if (count++ == 1) { return null; } else { - return new ArrayList(); + return new ArrayList<>(); } } }) @@ -1419,7 +1419,7 @@ public Collection get() throws Exception { if (count++ == 1) { throw new TestException(); } else { - return new ArrayList(); + return new ArrayList<>(); } } }, false) @@ -1439,7 +1439,7 @@ public Collection get() throws Exception { if (count++ == 1) { throw new TestException(); } else { - return new ArrayList(); + return new ArrayList<>(); } } }, false) @@ -1459,7 +1459,7 @@ public Collection get() throws Exception { if (count++ == 1) { throw new TestException(); } else { - return new ArrayList(); + return new ArrayList<>(); } } }) @@ -1497,7 +1497,7 @@ public List get() throws Exception { if (++calls == 2) { throw new TestException(); } - return new ArrayList(); + return new ArrayList<>(); } }) .test() @@ -1515,7 +1515,7 @@ public List get() throws Exception { if (++calls == 1) { throw new TestException(); } - return new ArrayList(); + return new ArrayList<>(); } }) .test() @@ -1533,7 +1533,7 @@ public List get() throws Exception { if (++calls == 2) { throw new TestException(); } - return new ArrayList(); + return new ArrayList<>(); } }) .test() @@ -1624,7 +1624,7 @@ public List get() throws Exception { if (++calls == 2) { throw new TestException(); } - return new ArrayList(); + return new ArrayList<>(); } }, true) .test(); @@ -2204,7 +2204,7 @@ public List get() throws Exception { if (++calls == 2) { throw new TestException(); } - return new ArrayList(); + return new ArrayList<>(); } }).test(); @@ -2226,7 +2226,7 @@ protected void subscribeActual(Subscriber subscriber) { } }; - final AtomicReference> ref = new AtomicReference>(); + final AtomicReference> ref = new AtomicReference<>(); Flowable b = new Flowable() { @Override protected void subscribeActual(Subscriber subscriber) { @@ -2303,10 +2303,10 @@ public void timedCancelledUpfront() { public void timedInternalState() { TestScheduler sch = new TestScheduler(); - TestSubscriber> ts = new TestSubscriber>(); + TestSubscriber> ts = new TestSubscriber<>(); - BufferExactUnboundedSubscriber> sub = new BufferExactUnboundedSubscriber>( - ts, Functions.justSupplier((List)new ArrayList()), 1, TimeUnit.SECONDS, sch); + BufferExactUnboundedSubscriber> sub = new BufferExactUnboundedSubscriber<>( + ts, Functions.justSupplier((List) new ArrayList()), 1, TimeUnit.SECONDS, sch); sub.onSubscribe(new BooleanSubscription()); @@ -2322,7 +2322,7 @@ public void timedInternalState() { assertTrue(sub.isDisposed()); - sub.buffer = new ArrayList(); + sub.buffer = new ArrayList<>(); sub.enter(); sub.onComplete(); } @@ -2353,10 +2353,10 @@ public Publisher> apply(Flowable f) public void timedSkipInternalState() { TestScheduler sch = new TestScheduler(); - TestSubscriber> ts = new TestSubscriber>(); + TestSubscriber> ts = new TestSubscriber<>(); - BufferSkipBoundedSubscriber> sub = new BufferSkipBoundedSubscriber>( - ts, Functions.justSupplier((List)new ArrayList()), 1, 1, TimeUnit.SECONDS, sch.createWorker()); + BufferSkipBoundedSubscriber> sub = new BufferSkipBoundedSubscriber<>( + ts, Functions.justSupplier((List) new ArrayList()), 1, 1, TimeUnit.SECONDS, sch.createWorker()); sub.onSubscribe(new BooleanSubscription()); @@ -2372,19 +2372,20 @@ public void timedSkipInternalState() { public void timedSkipCancelWhenSecondBuffer() { TestScheduler sch = new TestScheduler(); - final TestSubscriber> ts = new TestSubscriber>(); + final TestSubscriber> ts = new TestSubscriber<>(); - BufferSkipBoundedSubscriber> sub = new BufferSkipBoundedSubscriber>( + BufferSkipBoundedSubscriber> sub = new BufferSkipBoundedSubscriber<>( ts, new Supplier>() { - int calls; - @Override - public List get() throws Exception { - if (++calls == 2) { - ts.cancel(); - } - return new ArrayList(); - } - }, 1, 1, TimeUnit.SECONDS, sch.createWorker()); + int calls; + + @Override + public List get() throws Exception { + if (++calls == 2) { + ts.cancel(); + } + return new ArrayList<>(); + } + }, 1, 1, TimeUnit.SECONDS, sch.createWorker()); sub.onSubscribe(new BooleanSubscription()); @@ -2397,11 +2398,11 @@ public List get() throws Exception { public void timedSizeBufferAlreadyCleared() { TestScheduler sch = new TestScheduler(); - TestSubscriber> ts = new TestSubscriber>(); + TestSubscriber> ts = new TestSubscriber<>(); BufferExactBoundedSubscriber> sub = - new BufferExactBoundedSubscriber>( - ts, Functions.justSupplier((List)new ArrayList()), + new BufferExactBoundedSubscriber<>( + ts, Functions.justSupplier((List) new ArrayList()), 1, TimeUnit.SECONDS, 1, false, sch.createWorker()) ; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCacheTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCacheTest.java index e13ef40f0c..a317055889 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCacheTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCacheTest.java @@ -35,11 +35,11 @@ public class FlowableCacheTest extends RxJavaTest { @Test public void coldReplayNoBackpressure() { - FlowableCache source = new FlowableCache(Flowable.range(0, 1000), 16); + FlowableCache source = new FlowableCache<>(Flowable.range(0, 1000), 16); assertFalse("Source is connected!", source.isConnected()); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); source.subscribe(ts); @@ -58,11 +58,11 @@ public void coldReplayNoBackpressure() { @Test public void coldReplayBackpressure() { - FlowableCache source = new FlowableCache(Flowable.range(0, 1000), 16); + FlowableCache source = new FlowableCache<>(Flowable.range(0, 1000), 16); assertFalse("Source is connected!", source.isConnected()); - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); ts.request(10); source.subscribe(ts); @@ -145,9 +145,9 @@ public void unsubscribeSource() throws Throwable { @Test public void take() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); - FlowableCache cached = new FlowableCache(Flowable.range(1, 100), 16); + FlowableCache cached = new FlowableCache<>(Flowable.range(1, 100), 16); cached.take(10).subscribe(ts); ts.assertNoErrors(); @@ -160,9 +160,9 @@ public void take() { public void async() { Flowable source = Flowable.range(1, 10000); for (int i = 0; i < 100; i++) { - TestSubscriber ts1 = new TestSubscriber(); + TestSubscriber ts1 = new TestSubscriber<>(); - FlowableCache cached = new FlowableCache(source, 16); + FlowableCache cached = new FlowableCache<>(source, 16); cached.observeOn(Schedulers.computation()).subscribe(ts1); @@ -171,7 +171,7 @@ public void async() { ts1.assertComplete(); assertEquals(10000, ts1.values().size()); - TestSubscriber ts2 = new TestSubscriber(); + TestSubscriber ts2 = new TestSubscriber<>(); cached.observeOn(Schedulers.computation()).subscribe(ts2); ts2.awaitDone(2, TimeUnit.SECONDS); @@ -186,18 +186,18 @@ public void asyncComeAndGo() { Flowable source = Flowable.interval(1, 1, TimeUnit.MILLISECONDS) .take(1000) .subscribeOn(Schedulers.io()); - FlowableCache cached = new FlowableCache(source, 16); + FlowableCache cached = new FlowableCache<>(source, 16); Flowable output = cached.observeOn(Schedulers.computation()); - List> list = new ArrayList>(100); + List> list = new ArrayList<>(100); for (int i = 0; i < 100; i++) { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); list.add(ts); output.skip(i * 10).take(10).subscribe(ts); } - List expected = new ArrayList(); + List expected = new ArrayList<>(); for (int i = 0; i < 10; i++) { expected.add((long)(i - 10)); } @@ -231,7 +231,7 @@ public void subscribe(Subscriber t) { } }); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); firehose.cache().observeOn(Schedulers.computation()).takeLast(100).subscribe(ts); ts.awaitDone(3, TimeUnit.SECONDS); @@ -247,14 +247,14 @@ public void valuesAndThenError() { .concatWith(Flowable.error(new TestException())) .cache(); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); source.subscribe(ts); ts.assertValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); ts.assertNotComplete(); ts.assertError(TestException.class); - TestSubscriber ts2 = new TestSubscriber(); + TestSubscriber ts2 = new TestSubscriber<>(); source.subscribe(ts2); ts2.assertValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); @@ -294,7 +294,7 @@ public void subscribeEmitRace() { cache.test(); - final TestSubscriberEx ts = new TestSubscriberEx(); + final TestSubscriberEx ts = new TestSubscriberEx<>(); Runnable r1 = new Runnable() { @Override @@ -432,8 +432,8 @@ public void subscribeSubscribeRace() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { final Flowable cache = Flowable.range(1, 500).cache(); - final TestSubscriberEx ts1 = new TestSubscriberEx(); - final TestSubscriberEx ts2 = new TestSubscriberEx(); + final TestSubscriberEx ts1 = new TestSubscriberEx<>(); + final TestSubscriberEx ts2 = new TestSubscriberEx<>(); Runnable r1 = new Runnable() { @Override @@ -476,7 +476,7 @@ public void subscribeCompleteRace() { cache.test(); - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Runnable r1 = new Runnable() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCombineLatestTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCombineLatestTest.java index 836fd8a4c3..8ed8197138 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCombineLatestTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCombineLatestTest.java @@ -437,8 +437,8 @@ public List apply(Object[] args) { }; for (int i = 1; i <= n; i++) { System.out.println("test1ToNSources: " + i + " sources"); - List> sources = new ArrayList>(); - List values = new ArrayList(); + List> sources = new ArrayList<>(); + List values = new ArrayList<>(); for (int j = 0; j < i; j++) { sources.add(Flowable.just(j)); values.add(j); @@ -468,8 +468,8 @@ public List apply(Object[] args) { }; for (int i = 1; i <= n; i++) { System.out.println("test1ToNSourcesScheduled: " + i + " sources"); - List> sources = new ArrayList>(); - List values = new ArrayList(); + List> sources = new ArrayList<>(); + List values = new ArrayList<>(); for (int j = 0; j < i; j++) { sources.add(Flowable.just(j).subscribeOn(Schedulers.io())); values.add(j); @@ -749,7 +749,7 @@ public void backpressure() { BiFunction combineLatestFunction = getConcatStringIntegerCombineLatestFunction(); int num = Flowable.bufferSize() * 4; - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.combineLatest( Flowable.just("one", "two"), Flowable.range(2, num), @@ -784,7 +784,7 @@ public void accept(Notification n) { } }).take(SIZE); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.combineLatest(timer, Flowable. never(), new BiFunction() { @Override @@ -889,7 +889,7 @@ public Integer apply(Object[] args) { public void combineMany() { int n = Flowable.bufferSize() * 3; - List> sources = new ArrayList>(); + List> sources = new ArrayList<>(); StringBuilder expected = new StringBuilder(n * 2); @@ -1066,7 +1066,7 @@ public void combineLatestArrayNSources() { for (int i = 1; i < 100; i++) { Flowable[] sources = new Flowable[i]; Arrays.fill(sources, Flowable.just(1)); - List expected = new ArrayList(i); + List expected = new ArrayList<>(i); for (int j = 1; j <= i; j++) { expected.add(1); } @@ -1207,7 +1207,7 @@ public Object apply(Object a, Object b) throws Exception { @Test public void cancelWhileSubscribing() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.combineLatest( Flowable.just(1) diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatDelayErrorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatDelayErrorTest.java index e5ce3766ea..0543eb1b0f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatDelayErrorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatDelayErrorTest.java @@ -232,7 +232,7 @@ public void concatDelayErrorFlowable() { @Test public void concatDelayErrorFlowableError() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); Flowable.concatDelayError( withError(Flowable.just(withError(Flowable.just(1)), withError(Flowable.just(2))))) @@ -269,7 +269,7 @@ public void concatDelayErrorIterable() { @SuppressWarnings("unchecked") @Test public void concatDelayErrorIterableError() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); Flowable.concatDelayError( Arrays.asList(withError(Flowable.just(1)), withError(Flowable.just(2)))) diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEagerTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEagerTest.java index 5f41cce3dc..5c052d616c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEagerTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapEagerTest.java @@ -276,8 +276,8 @@ public Flowable apply(Integer t) { @Before public void before() { - ts = new TestSubscriber(); - tsBp = new TestSubscriber(0L); + ts = new TestSubscriber<>(); + tsBp = new TestSubscriber<>(0L); } @Test @@ -642,7 +642,7 @@ public void accept(Integer t) { @Test public void maxConcurrent5() { - final List requests = new ArrayList(); + final List requests = new ArrayList<>(); Flowable.range(1, 100).doOnRequest(new LongConsumer() { @Override public void accept(long reqCount) { @@ -955,7 +955,7 @@ public void run() { @Test public void mapperCancels() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.just(1).hide() .concatMapEager(new Function>() { @@ -1097,7 +1097,7 @@ public void drainCancelRaceOnEmpty() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { final PublishProcessor pp = PublishProcessor.create(); - final TestSubscriber ts = new TestSubscriber(0L); + final TestSubscriber ts = new TestSubscriber<>(0L); Flowable.just(1) .concatMapEager(Functions.justFunction(pp)) @@ -1157,7 +1157,7 @@ public Flowable apply(Integer i) throws Exception { public void maxConcurrencyOf2() { List[] list = new ArrayList[100]; for (int i = 0; i < 100; i++) { - List lst = new ArrayList(); + List lst = new ArrayList<>(); list[i] = lst; for (int k = 1; k <= 10; k++) { lst.add((i) * 10 + k); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapSchedulerTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapSchedulerTest.java index fc8d665559..0cd7562199 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapSchedulerTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapSchedulerTest.java @@ -366,7 +366,7 @@ public void concatMapRangeAsyncLoopIssue2876() { if (i % 1000 == 0) { System.out.println("concatMapRangeAsyncLoop > " + i); } - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); Flowable.range(0, 1000) .concatMap(new Function>() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapTest.java index 74394b122e..e815c3675e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatMapTest.java @@ -33,8 +33,8 @@ public class FlowableConcatMapTest extends RxJavaTest { @Test public void weakSubscriptionRequest() { - TestSubscriber ts = new TestSubscriber(0); - WeakScalarSubscription ws = new WeakScalarSubscription(1, ts); + TestSubscriber ts = new TestSubscriber<>(0); + WeakScalarSubscription ws = new WeakScalarSubscription<>(1, ts); ts.onSubscribe(ws); ws.request(0); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatTest.java index a0b14ead5a..67451d6097 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatTest.java @@ -65,7 +65,7 @@ public void concatWithList() { final Flowable odds = Flowable.fromArray(o); final Flowable even = Flowable.fromArray(e); - final List> list = new ArrayList>(); + final List> list = new ArrayList<>(); list.add(odds); list.add(even); Flowable concat = Flowable.concat(Flowable.fromIterable(list)); @@ -110,8 +110,8 @@ public void subscribe(Subscriber> subscriber) { public void simpleAsyncConcat() { Subscriber subscriber = TestHelper.mockSubscriber(); - TestObservable o1 = new TestObservable("one", "two", "three"); - TestObservable o2 = new TestObservable("four", "five", "six"); + TestObservable o1 = new TestObservable<>("one", "two", "three"); + TestObservable o2 = new TestObservable<>("four", "five", "six"); Flowable.concat(Flowable.unsafeCreate(o1), Flowable.unsafeCreate(o2)).subscribe(subscriber); @@ -150,12 +150,12 @@ public void nestedAsyncConcatLoop() throws Throwable { public void nestedAsyncConcat() throws InterruptedException { Subscriber subscriber = TestHelper.mockSubscriber(); - final TestObservable o1 = new TestObservable("one", "two", "three"); - final TestObservable o2 = new TestObservable("four", "five", "six"); - final TestObservable o3 = new TestObservable("seven", "eight", "nine"); + final TestObservable o1 = new TestObservable<>("one", "two", "three"); + final TestObservable o2 = new TestObservable<>("four", "five", "six"); + final TestObservable o3 = new TestObservable<>("seven", "eight", "nine"); final CountDownLatch allowThird = new CountDownLatch(1); - final AtomicReference parent = new AtomicReference(); + final AtomicReference parent = new AtomicReference<>(); final CountDownLatch parentHasStarted = new CountDownLatch(1); final CountDownLatch parentHasFinished = new CountDownLatch(1); @@ -284,7 +284,7 @@ public void blockedObservableOfObservables() { final CountDownLatch callOnce = new CountDownLatch(1); final CountDownLatch okToContinue = new CountDownLatch(1); @SuppressWarnings("unchecked") - TestObservable> observableOfObservables = new TestObservable>(callOnce, okToContinue, odds, even); + TestObservable> observableOfObservables = new TestObservable<>(callOnce, okToContinue, odds, even); Flowable concatF = Flowable.concat(Flowable.unsafeCreate(observableOfObservables)); concatF.subscribe(subscriber); try { @@ -316,14 +316,14 @@ public void blockedObservableOfObservables() { @Test public void concatConcurrentWithInfinity() { - final TestObservable w1 = new TestObservable("one", "two", "three"); + final TestObservable w1 = new TestObservable<>("one", "two", "three"); //This observable will send "hello" MAX_VALUE time. - final TestObservable w2 = new TestObservable("hello", Integer.MAX_VALUE); + final TestObservable w2 = new TestObservable<>("hello", Integer.MAX_VALUE); Subscriber subscriber = TestHelper.mockSubscriber(); @SuppressWarnings("unchecked") - TestObservable> observableOfObservables = new TestObservable>(Flowable.unsafeCreate(w1), Flowable.unsafeCreate(w2)); + TestObservable> observableOfObservables = new TestObservable<>(Flowable.unsafeCreate(w1), Flowable.unsafeCreate(w2)); Flowable concatF = Flowable.concat(Flowable.unsafeCreate(observableOfObservables)); concatF.take(50).subscribe(subscriber); @@ -351,8 +351,8 @@ public void concatNonBlockingObservables() { final CountDownLatch okToContinueW1 = new CountDownLatch(1); final CountDownLatch okToContinueW2 = new CountDownLatch(1); - final TestObservable w1 = new TestObservable(null, okToContinueW1, "one", "two", "three"); - final TestObservable w2 = new TestObservable(null, okToContinueW2, "four", "five", "six"); + final TestObservable w1 = new TestObservable<>(null, okToContinueW1, "one", "two", "three"); + final TestObservable w2 = new TestObservable<>(null, okToContinueW2, "four", "five", "six"); Subscriber subscriber = TestHelper.mockSubscriber(); @@ -402,11 +402,11 @@ public void subscribe(Subscriber> subscriber) { public void concatUnsubscribe() { final CountDownLatch callOnce = new CountDownLatch(1); final CountDownLatch okToContinue = new CountDownLatch(1); - final TestObservable w1 = new TestObservable("one", "two", "three"); - final TestObservable w2 = new TestObservable(callOnce, okToContinue, "four", "five", "six"); + final TestObservable w1 = new TestObservable<>("one", "two", "three"); + final TestObservable w2 = new TestObservable<>(callOnce, okToContinue, "four", "five", "six"); Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber, 0L); + TestSubscriber ts = new TestSubscriber<>(subscriber, 0L); final Flowable concat = Flowable.concat(Flowable.unsafeCreate(w1), Flowable.unsafeCreate(w2)); @@ -444,14 +444,14 @@ public void concatUnsubscribe() { public void concatUnsubscribeConcurrent() { final CountDownLatch callOnce = new CountDownLatch(1); final CountDownLatch okToContinue = new CountDownLatch(1); - final TestObservable w1 = new TestObservable("one", "two", "three"); - final TestObservable w2 = new TestObservable(callOnce, okToContinue, "four", "five", "six"); + final TestObservable w1 = new TestObservable<>("one", "two", "three"); + final TestObservable w2 = new TestObservable<>(callOnce, okToContinue, "four", "five", "six"); Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber, 0L); + TestSubscriber ts = new TestSubscriber<>(subscriber, 0L); @SuppressWarnings("unchecked") - TestObservable> observableOfObservables = new TestObservable>(Flowable.unsafeCreate(w1), Flowable.unsafeCreate(w2)); + TestObservable> observableOfObservables = new TestObservable<>(Flowable.unsafeCreate(w1), Flowable.unsafeCreate(w2)); Flowable concatF = Flowable.concat(Flowable.unsafeCreate(observableOfObservables)); concatF.subscribe(ts); @@ -630,7 +630,7 @@ public Flowable apply(Integer v) { result.subscribe(o); - List list = new ArrayList(n); + List list = new ArrayList<>(n); for (int i = 0; i < n; i++) { list.add(i); } @@ -655,7 +655,7 @@ public Flowable apply(Integer v) { result.subscribe(o); - List list = new ArrayList(n); + List list = new ArrayList<>(n); for (int i = 0; i < n / 2; i++) { list.add(i); } @@ -674,7 +674,7 @@ public void concatOuterBackpressure() { @Test public void innerBackpressureWithAlignedBoundaries() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(0, Flowable.bufferSize() * 2) .concatWith(Flowable.range(0, Flowable.bufferSize() * 2)) .observeOn(Schedulers.computation()) // observeOn has a backpressured RxRingBuffer @@ -693,7 +693,7 @@ public void innerBackpressureWithAlignedBoundaries() { */ @Test public void innerBackpressureWithoutAlignedBoundaries() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(0, (Flowable.bufferSize() * 2) + 10) .concatWith(Flowable.range(0, (Flowable.bufferSize() * 2) + 10)) .observeOn(Schedulers.computation()) // observeOn has a backpressured RxRingBuffer @@ -719,7 +719,7 @@ public void subscribe(Subscriber s) { }); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); Flowable.concat(f, f).subscribe(ts); ts.awaitDone(500, TimeUnit.MILLISECONDS); ts.assertTerminated(); @@ -815,7 +815,7 @@ public void concatMapRangeAsyncLoopIssue2876() { if (i % 1000 == 0) { System.out.println("concatMapRangeAsyncLoop > " + i); } - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); Flowable.range(0, 1000) .concatMap(new Function>() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithCompletableTest.java index a89897090a..fcf199dfd0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithCompletableTest.java @@ -33,7 +33,7 @@ public class FlowableConcatWithCompletableTest extends RxJavaTest { @Test public void normal() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 5) .concatWith(Completable.fromAction(new Action() { @@ -49,7 +49,7 @@ public void run() throws Exception { @Test public void mainError() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.error(new TestException()) .concatWith(Completable.fromAction(new Action() { @@ -65,7 +65,7 @@ public void run() throws Exception { @Test public void otherError() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 5) .concatWith(Completable.error(new TestException())) @@ -76,7 +76,7 @@ public void otherError() { @Test public void takeMain() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 5) .concatWith(Completable.fromAction(new Action() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithMaybeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithMaybeTest.java index ea9e8f2330..a855c09c26 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithMaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithMaybeTest.java @@ -27,7 +27,7 @@ public class FlowableConcatWithMaybeTest extends RxJavaTest { @Test public void normalEmpty() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 5) .concatWith(Maybe.fromAction(new Action() { @@ -43,7 +43,7 @@ public void run() throws Exception { @Test public void normalNonEmpty() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 5) .concatWith(Maybe.just(100)) @@ -68,7 +68,7 @@ public void backpressure() { @Test public void mainError() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.error(new TestException()) .concatWith(Maybe.fromAction(new Action() { @@ -84,7 +84,7 @@ public void run() throws Exception { @Test public void otherError() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 5) .concatWith(Maybe.error(new TestException())) @@ -95,7 +95,7 @@ public void otherError() { @Test public void takeMain() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 5) .concatWith(Maybe.fromAction(new Action() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithSingleTest.java index c846a2f5d5..4301746a86 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithSingleTest.java @@ -26,7 +26,7 @@ public class FlowableConcatWithSingleTest extends RxJavaTest { @Test public void normal() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 5) .concatWith(Single.just(100)) @@ -51,7 +51,7 @@ public void backpressure() { @Test public void mainError() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.error(new TestException()) .concatWith(Single.just(100)) @@ -62,7 +62,7 @@ public void mainError() { @Test public void otherError() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 5) .concatWith(Single.error(new TestException())) @@ -73,7 +73,7 @@ public void otherError() { @Test public void takeMain() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 5) .concatWith(Single.just(100)) diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCreateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCreateTest.java index e6470fe6c9..d0c0adfb70 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCreateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCreateTest.java @@ -1063,7 +1063,7 @@ public void subscribe(FlowableEmitter e) throws Exception { @Test public void emittersHasToString() { Map> emitterMap = - new HashMap>(); + new HashMap<>(); emitterMap.put(BackpressureStrategy.MISSING, FlowableCreate.MissingEmitter.class); emitterMap.put(BackpressureStrategy.ERROR, FlowableCreate.ErrorAsyncEmitter.class); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounceTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounceTest.java index 17ae8ef654..bfb33f0e8e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounceTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounceTest.java @@ -289,7 +289,7 @@ public Flowable apply(Integer t1) { @Test public void debounceWithTimeBackpressure() throws InterruptedException { TestScheduler scheduler = new TestScheduler(); - TestSubscriberEx subscriber = new TestSubscriberEx(); + TestSubscriberEx subscriber = new TestSubscriberEx<>(); Flowable.merge( Flowable.just(1), Flowable.just(2).delay(10, TimeUnit.MILLISECONDS, scheduler) @@ -305,7 +305,7 @@ public void debounceWithTimeBackpressure() throws InterruptedException { @Test public void debounceDefaultScheduler() throws Exception { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 1000).debounce(1, TimeUnit.SECONDS).subscribe(ts); @@ -330,7 +330,7 @@ public void dispose() { TestHelper.checkDisposed(PublishProcessor.create().debounce(Functions.justFunction(Flowable.never()))); - Disposable d = new FlowableDebounceTimed.DebounceEmitter(1, 1, null); + Disposable d = new FlowableDebounceTimed.DebounceEmitter<>(1, 1, null); assertFalse(d.isDisposed()); d.dispose(); @@ -426,7 +426,7 @@ public Flowable apply(Flowable f) throws Exception { @Test public void disposeInOnNext() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); BehaviorProcessor.createDefault(1) .debounce(new Function>() { @@ -444,7 +444,7 @@ public Flowable apply(Integer o) throws Exception { @Test public void disposedInOnComplete() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); new Flowable() { @Override @@ -461,7 +461,7 @@ protected void subscribeActual(Subscriber subscriber) { @Test public void emitLate() { - final AtomicReference> ref = new AtomicReference>(); + final AtomicReference> ref = new AtomicReference<>(); TestSubscriber ts = Flowable.range(1, 2) .debounce(new Function>() { @@ -505,7 +505,7 @@ public Publisher apply(Flowable f) @Test public void timedDisposedIgnoredBySource() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); new Flowable() { @Override @@ -528,13 +528,13 @@ public void timedBadRequest() { @Test public void timedLateEmit() { - TestSubscriber ts = new TestSubscriber(); - DebounceTimedSubscriber sub = new DebounceTimedSubscriber( + TestSubscriber ts = new TestSubscriber<>(); + DebounceTimedSubscriber sub = new DebounceTimedSubscriber<>( ts, 1, TimeUnit.SECONDS, new TestScheduler().createWorker()); sub.onSubscribe(new BooleanSubscription()); - DebounceEmitter de = new DebounceEmitter(1, 50, sub); + DebounceEmitter de = new DebounceEmitter<>(1, 50, sub); de.emit(); de.emit(); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDefaultIfEmptyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDefaultIfEmptyTest.java index ff99ca80e1..dadec04fbe 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDefaultIfEmptyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDefaultIfEmptyTest.java @@ -57,7 +57,7 @@ public void defaultIfEmptyWithEmpty() { @Test public void backpressureEmpty() { - TestSubscriberEx ts = new TestSubscriberEx(0L); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); Flowable.empty().defaultIfEmpty(1).subscribe(ts); ts.assertNoValues(); ts.assertNotTerminated(); @@ -69,7 +69,7 @@ public void backpressureEmpty() { @Test public void backpressureNonEmpty() { - TestSubscriberEx ts = new TestSubscriberEx(0L); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); Flowable.just(1, 2, 3).defaultIfEmpty(1).subscribe(ts); ts.assertNoValues(); ts.assertNotTerminated(); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelaySubscriptionOtherTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelaySubscriptionOtherTest.java index 9ac97e12ab..fde11b5ea1 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelaySubscriptionOtherTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelaySubscriptionOtherTest.java @@ -31,7 +31,7 @@ public class FlowableDelaySubscriptionOtherTest extends RxJavaTest { public void noPrematureSubscription() { PublishProcessor other = PublishProcessor.create(); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); final AtomicInteger subscribed = new AtomicInteger(); @@ -64,7 +64,7 @@ public void accept(Subscription s) { public void noMultipleSubscriptions() { PublishProcessor other = PublishProcessor.create(); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); final AtomicInteger subscribed = new AtomicInteger(); @@ -98,7 +98,7 @@ public void accept(Subscription s) { public void completeTriggersSubscription() { PublishProcessor other = PublishProcessor.create(); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); final AtomicInteger subscribed = new AtomicInteger(); @@ -131,7 +131,7 @@ public void accept(Subscription s) { public void noPrematureSubscriptionToError() { PublishProcessor other = PublishProcessor.create(); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); final AtomicInteger subscribed = new AtomicInteger(); @@ -164,7 +164,7 @@ public void accept(Subscription s) { public void noSubscriptionIfOtherErrors() { PublishProcessor other = PublishProcessor.create(); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); final AtomicInteger subscribed = new AtomicInteger(); @@ -198,7 +198,7 @@ public void backpressurePassesThrough() { PublishProcessor other = PublishProcessor.create(); - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); final AtomicInteger subscribed = new AtomicInteger(); @@ -249,7 +249,7 @@ public void unsubscriptionPropagatesBeforeSubscribe() { PublishProcessor source = PublishProcessor.create(); PublishProcessor other = PublishProcessor.create(); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); source.delaySubscription(other).subscribe(ts); @@ -267,7 +267,7 @@ public void unsubscriptionPropagatesAfterSubscribe() { PublishProcessor source = PublishProcessor.create(); PublishProcessor other = PublishProcessor.create(); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); source.delaySubscription(other).subscribe(ts); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelayTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelayTest.java index c5167f4fcd..79740ee44c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelayTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDelayTest.java @@ -218,7 +218,7 @@ public void delaySubscriptionCancelBeforeTime() { Flowable result = Flowable.just(1, 2, 3).delaySubscription(100, TimeUnit.MILLISECONDS, scheduler); Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); result.subscribe(ts); ts.cancel(); @@ -232,7 +232,7 @@ public void delaySubscriptionCancelBeforeTime() { @Test public void delayWithFlowableNormal1() { PublishProcessor source = PublishProcessor.create(); - final List> delays = new ArrayList>(); + final List> delays = new ArrayList<>(); final int n = 10; for (int i = 0; i < n; i++) { PublishProcessor delay = PublishProcessor.create(); @@ -577,7 +577,7 @@ public void delayWithFlowableReorder() { int n = 3; PublishProcessor source = PublishProcessor.create(); - final List> subjects = new ArrayList>(); + final List> subjects = new ArrayList<>(); for (int i = 0; i < n; i++) { subjects.add(PublishProcessor. create()); } @@ -625,7 +625,7 @@ public void accept(Notification t1) { } }); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); delayed.subscribe(ts); // all will be delivered after 500ms since range does not delay between them scheduler.advanceTimeBy(500L, TimeUnit.MILLISECONDS); @@ -634,7 +634,7 @@ public void accept(Notification t1) { @Test public void backpressureWithTimedDelay() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, Flowable.bufferSize() * 2) .delay(100, TimeUnit.MILLISECONDS) .observeOn(Schedulers.computation()) @@ -662,7 +662,7 @@ public Integer apply(Integer t) { @Test public void backpressureWithSubscriptionTimedDelay() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, Flowable.bufferSize() * 2) .delaySubscription(100, TimeUnit.MILLISECONDS) .delay(100, TimeUnit.MILLISECONDS) @@ -691,7 +691,7 @@ public Integer apply(Integer t) { @Test public void backpressureWithSelectorDelay() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, Flowable.bufferSize() * 2) .delay(new Function>() { @@ -726,7 +726,7 @@ public Integer apply(Integer t) { @Test public void backpressureWithSelectorDelayAndSubscriptionDelay() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, Flowable.bufferSize() * 2) .delay(Flowable.defer(new Supplier>() { @@ -771,7 +771,7 @@ public void errorRunsBeforeOnNext() { PublishProcessor pp = PublishProcessor.create(); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); pp.delay(1, TimeUnit.SECONDS, test).subscribe(ts); @@ -794,7 +794,7 @@ public void delaySupplierSimple() { Flowable source = Flowable.range(1, 5); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); source.delaySubscription(Flowable.defer(new Supplier>() { @Override @@ -820,7 +820,7 @@ public void delaySupplierCompletes() { Flowable source = Flowable.range(1, 5); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); source.delaySubscription(Flowable.defer(new Supplier>() { @Override @@ -847,7 +847,7 @@ public void delaySupplierErrors() { Flowable source = Flowable.range(1, 5); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); source.delaySubscription(Flowable.defer(new Supplier>() { @Override @@ -904,7 +904,7 @@ public void delaySubscriptionDisposeBeforeTime() { Flowable result = Flowable.just(1, 2, 3).delaySubscription(100, TimeUnit.MILLISECONDS, scheduler); Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); result.subscribe(ts); ts.cancel(); @@ -918,7 +918,7 @@ public void delaySubscriptionDisposeBeforeTime() { @Test public void onErrorCalledOnScheduler() throws Exception { final CountDownLatch latch = new CountDownLatch(1); - final AtomicReference thread = new AtomicReference(); + final AtomicReference thread = new AtomicReference<>(); Flowable.error(new Exception()) .delay(0, TimeUnit.MILLISECONDS, Schedulers.newThread()) diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDematerializeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDematerializeTest.java index 75a05cbd23..d4578db529 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDematerializeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDematerializeTest.java @@ -141,7 +141,7 @@ public void completePassThru() { Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriberEx ts = new TestSubscriberEx(subscriber); + TestSubscriberEx ts = new TestSubscriberEx<>(subscriber); dematerialize.subscribe(ts); System.out.println(ts.errors()); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDetachTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDetachTest.java index c328565218..3c87bfeb9a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDetachTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDetachTest.java @@ -35,9 +35,9 @@ public class FlowableDetachTest extends RxJavaTest { public void just() throws Exception { o = new Object(); - WeakReference wr = new WeakReference(o); + WeakReference wr = new WeakReference<>(o); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.just(o).count().toFlowable().onTerminateDetach().subscribe(ts); @@ -56,7 +56,7 @@ public void just() throws Exception { @Test public void error() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.error(new TestException()).onTerminateDetach().subscribe(ts); @@ -67,7 +67,7 @@ public void error() { @Test public void empty() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.empty().onTerminateDetach().subscribe(ts); @@ -78,7 +78,7 @@ public void empty() { @Test public void range() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 1000).onTerminateDetach().subscribe(ts); @@ -91,9 +91,9 @@ public void range() { public void backpressured() throws Exception { o = new Object(); - WeakReference wr = new WeakReference(o); + WeakReference wr = new WeakReference<>(o); - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); Flowable.just(o).count().toFlowable().onTerminateDetach().subscribe(ts); @@ -117,9 +117,9 @@ public void backpressured() throws Exception { public void justUnsubscribed() throws Exception { o = new Object(); - WeakReference wr = new WeakReference(o); + WeakReference wr = new WeakReference<>(o); - TestSubscriber ts = new TestSubscriber(0); + TestSubscriber ts = new TestSubscriber<>(0); Flowable.just(o).count().toFlowable().onTerminateDetach().subscribe(ts); @@ -135,9 +135,9 @@ public void justUnsubscribed() throws Exception { @Test public void deferredUpstreamProducer() { - final AtomicReference> subscriber = new AtomicReference>(); + final AtomicReference> subscriber = new AtomicReference<>(); - TestSubscriber ts = new TestSubscriber(0); + TestSubscriber ts = new TestSubscriber<>(0); Flowable.unsafeCreate(new Publisher() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterNextTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterNextTest.java index 51b27abad1..47f0d74e0b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterNextTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterNextTest.java @@ -30,7 +30,7 @@ public class FlowableDoAfterNextTest extends RxJavaTest { - final List values = new ArrayList(); + final List values = new ArrayList<>(); final Consumer afterNext = new Consumer() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterTerminateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterTerminateTest.java index 210ed3879b..cee677cf41 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterTerminateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoAfterTerminateTest.java @@ -91,7 +91,7 @@ public void ifFinallyActionThrowsExceptionShouldNotBeSwallowedAndActionShouldBeC Action finallyAction = Mockito.mock(Action.class); doThrow(new IllegalStateException()).when(finallyAction).run(); - TestSubscriber testSubscriber = new TestSubscriber(); + TestSubscriber testSubscriber = new TestSubscriber<>(); Flowable .just("value") diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoFinallyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoFinallyTest.java index 7662162d22..8249383dca 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoFinallyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoFinallyTest.java @@ -440,7 +440,7 @@ public void onComplete() { @Test public void eventOrdering() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); Flowable.error(new TestException()) .doOnCancel(new Action() { @@ -480,7 +480,7 @@ public void run() throws Exception { @Test public void eventOrdering2() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); Flowable.just(1) .doOnCancel(new Action() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnEachTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnEachTest.java index deea77ea70..fc346086b6 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnEachTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnEachTest.java @@ -173,7 +173,7 @@ public void accept(List booleans) { @Test public void onErrorThrows() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); Flowable.error(new TestException()) .doOnError(new Consumer() { @@ -691,7 +691,7 @@ public void run() throws Exception { @Test public void dispose() { - TestHelper.checkDisposed(Flowable.just(1).doOnEach(new TestSubscriber())); + TestHelper.checkDisposed(Flowable.just(1).doOnEach(new TestSubscriber<>())); } @Test @@ -699,7 +699,7 @@ public void doubleOnSubscribe() { TestHelper.checkDoubleOnSubscribeFlowable(new Function, Flowable>() { @Override public Flowable apply(Flowable f) throws Exception { - return f.doOnEach(new TestSubscriber()); + return f.doOnEach(new TestSubscriber<>()); } }); } @@ -736,7 +736,7 @@ public void doOnNextDoOnErrorCombinedFused() { .compose(new FlowableTransformer() { @Override public Publisher apply(Flowable v) { - return new FlowableDoOnEach(v, + return new FlowableDoOnEach<>(v, new Consumer() { @Override public void accept(Integer v) throws Exception { @@ -752,7 +752,7 @@ public void accept(Throwable e) throws Exception { Functions.EMPTY_ACTION , Functions.EMPTY_ACTION - ); + ); } }) .publish(); @@ -866,7 +866,7 @@ public void doOnNextDoOnErrorCombinedFusedConditional() { .compose(new FlowableTransformer() { @Override public Publisher apply(Flowable v) { - return new FlowableDoOnEach(v, + return new FlowableDoOnEach<>(v, new Consumer() { @Override public void accept(Integer v) throws Exception { @@ -882,7 +882,7 @@ public void accept(Throwable e) throws Exception { Functions.EMPTY_ACTION , Functions.EMPTY_ACTION - ); + ); } }) .filter(Functions.alwaysTrue()) diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnRequestTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnRequestTest.java index e4eb8543f6..b07470a398 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnRequestTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnRequestTest.java @@ -51,7 +51,7 @@ public void accept(long n) { @Test public void doRequest() { - final List requests = new ArrayList(); + final List requests = new ArrayList<>(); Flowable.range(1, 5) // .doOnRequest(new LongConsumer() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnSubscribeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnSubscribeTest.java index f300d0427f..c9ea4359d1 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnSubscribeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnSubscribeTest.java @@ -66,7 +66,7 @@ public void doOnUnSubscribeWorksWithRefCount() throws Exception { final AtomicInteger onSubscribed = new AtomicInteger(); final AtomicInteger countBefore = new AtomicInteger(); final AtomicInteger countAfter = new AtomicInteger(); - final AtomicReference> sref = new AtomicReference>(); + final AtomicReference> sref = new AtomicReference<>(); Flowable f = Flowable.unsafeCreate(new Publisher() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnUnsubscribeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnUnsubscribeTest.java index 0a37faae1e..eab0324ba8 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnUnsubscribeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDoOnUnsubscribeTest.java @@ -67,11 +67,11 @@ public void run() { } }); - List subscriptions = new ArrayList(); - List> subscribers = new ArrayList>(); + List subscriptions = new ArrayList<>(); + List> subscribers = new ArrayList<>(); for (int i = 0; i < subCount; ++i) { - TestSubscriber subscriber = new TestSubscriber(); + TestSubscriber subscriber = new TestSubscriber<>(); subscriptions.add(Disposable.fromSubscription(subscriber)); longs.subscribe(subscriber); subscribers.add(subscriber); @@ -128,11 +128,11 @@ public void run() { .publish() .refCount(); - List subscriptions = new ArrayList(); - List> subscribers = new ArrayList>(); + List subscriptions = new ArrayList<>(); + List> subscribers = new ArrayList<>(); for (int i = 0; i < subCount; ++i) { - TestSubscriber subscriber = new TestSubscriber(); + TestSubscriber subscriber = new TestSubscriber<>(); longs.subscribe(subscriber); subscriptions.add(Disposable.fromSubscription(subscriber)); subscribers.add(subscriber); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtTest.java index 596e7b3867..56297cbe05 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtTest.java @@ -72,7 +72,7 @@ public void elementAt() { @Test public void elementAtConstrainsUpstreamRequests() { - final List requests = new ArrayList(); + final List requests = new ArrayList<>(); Flowable.fromArray(1, 2, 3, 4) .doOnRequest(new LongConsumer() { @Override @@ -88,7 +88,7 @@ public void accept(long n) throws Throwable { @Test public void elementAtWithDefaultConstrainsUpstreamRequests() { - final List requests = new ArrayList(); + final List requests = new ArrayList<>(); Flowable.fromArray(1, 2, 3, 4) .doOnRequest(new LongConsumer() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFilterTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFilterTest.java index 38e94571c2..86ad5aa874 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFilterTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFilterTest.java @@ -158,7 +158,7 @@ public void functionCrashUnsubscribes() { PublishProcessor pp = PublishProcessor.create(); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); pp.filter(new Predicate() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybeTest.java index d425ce8372..8faad86fef 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapMaybeTest.java @@ -523,7 +523,7 @@ public MaybeSource apply(PublishProcessor v) throws Exception @Test public void disposeInner() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.just(1).flatMapMaybe(new Function>() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSingleTest.java index 2d3699e8e2..1a0cd3854f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSingleTest.java @@ -408,7 +408,7 @@ public SingleSource apply(PublishProcessor v) throws Exception @Test public void disposeInner() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.just(1).flatMapSingle(new Function>() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapTest.java index 483d92062a..068f652db0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapTest.java @@ -343,13 +343,13 @@ public Flowable apply(Integer t1) { } }, m); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); source.subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); ts.assertNoErrors(); - Set expected = new HashSet(Arrays.asList( + Set expected = new HashSet<>(Arrays.asList( 10, 11, 20, 21, 30, 31, 40, 41, 50, 51, 60, 61, 70, 71, 80, 81, 90, 91, 100, 101 )); Assert.assertEquals(expected.size(), ts.values().size()); @@ -374,13 +374,13 @@ public Integer apply(Integer t1, Integer t2) { } }, m); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); source.subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); ts.assertNoErrors(); - Set expected = new HashSet(Arrays.asList( + Set expected = new HashSet<>(Arrays.asList( 1010, 1011, 2020, 2021, 3030, 3031, 4040, 4041, 5050, 5051, 6060, 6061, 7070, 7071, 8080, 8081, 9090, 9091, 10100, 10101 )); @@ -420,7 +420,7 @@ public void flatMapTransformsMaxConcurrentNormal() { Flowable source = Flowable.fromIterable(Arrays.asList(10, 20, 30)); Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriberEx ts = new TestSubscriberEx(subscriber); + TestSubscriberEx ts = new TestSubscriberEx<>(subscriber); Function> just = just(onNext); Function> just2 = just(onError); @@ -447,7 +447,7 @@ public void flatMapRangeMixedAsyncLoop() { if (i % 10 == 0) { System.out.println("flatMapRangeAsyncLoop > " + i); } - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); Flowable.range(0, 1000) .flatMap(new Function>() { final Random rnd = new Random(); @@ -471,7 +471,7 @@ public Flowable apply(Integer t) { ts.assertNoErrors(); List list = ts.values(); if (list.size() < 1000) { - Set set = new HashSet(list); + Set set = new HashSet<>(list); for (int j = 0; j < 1000; j++) { if (!set.contains(j)) { System.out.println(j + " missing"); @@ -485,7 +485,7 @@ public Flowable apply(Integer t) { @Test public void flatMapIntPassthruAsync() { for (int i = 0; i < 1000; i++) { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 1000).flatMap(new Function>() { @Override @@ -504,7 +504,7 @@ public Flowable apply(Integer t) { @Test public void flatMapTwoNestedSync() { for (final int n : new int[] { 1, 1000, 1000000 }) { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.just(1, 2).flatMap(new Function>() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlattenIterableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlattenIterableTest.java index e9e25c8af2..c65cf4b5b4 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlattenIterableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlattenIterableTest.java @@ -40,7 +40,7 @@ public class FlowableFlattenIterableTest extends RxJavaTest { @Test public void normal0() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 2) .reduce(new BiFunction() { @@ -72,7 +72,7 @@ public Iterable apply(Integer v) { @Test public void normal() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 5).concatMapIterable(mapper) .subscribe(ts); @@ -84,7 +84,7 @@ public void normal() { @Test public void normalViaFlatMap() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 5).flatMapIterable(mapper) .subscribe(ts); @@ -96,7 +96,7 @@ public void normalViaFlatMap() { @Test public void normalBackpressured() { - TestSubscriber ts = new TestSubscriber(0); + TestSubscriber ts = new TestSubscriber<>(0); Flowable.range(1, 5).concatMapIterable(mapper) .subscribe(ts); @@ -126,7 +126,7 @@ public void normalBackpressured() { @Test public void longRunning() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); int n = 1000 * 1000; @@ -140,7 +140,7 @@ public void longRunning() { @Test public void asIntermediate() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); int n = 1000 * 1000; @@ -159,7 +159,7 @@ public Flowable apply(Integer v) { @Test public void just() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.just(1).concatMapIterable(mapper) .subscribe(ts); @@ -171,7 +171,7 @@ public void just() { @Test public void justHidden() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.just(1).hide().concatMapIterable(mapper) .subscribe(ts); @@ -183,7 +183,7 @@ public void justHidden() { @Test public void empty() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.empty().concatMapIterable(mapper) .subscribe(ts); @@ -195,7 +195,7 @@ public void empty() { @Test public void error() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.just(1).concatWith(Flowable.error(new TestException())) .concatMapIterable(mapper) @@ -208,7 +208,7 @@ public void error() { @Test public void iteratorHasNextThrowsImmediately() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); final Iterable it = new Iterable() { @Override @@ -248,7 +248,7 @@ public Iterable apply(Integer v) { @Test public void iteratorHasNextThrowsImmediatelyJust() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); final Iterable it = new Iterable() { @Override @@ -288,7 +288,7 @@ public Iterable apply(Integer v) { @Test public void iteratorHasNextThrowsSecondCall() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); final Iterable it = new Iterable() { @Override @@ -332,7 +332,7 @@ public Iterable apply(Integer v) { @Test public void iteratorNextThrows() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); final Iterable it = new Iterable() { @Override @@ -372,7 +372,7 @@ public Iterable apply(Integer v) { @Test public void iteratorNextThrowsAndUnsubscribes() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); final Iterable it = new Iterable() { @Override @@ -418,7 +418,7 @@ public Iterable apply(Integer v) { @Test public void mixture() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(0, 1000) .concatMapIterable(new Function>() { @@ -436,7 +436,7 @@ public Iterable apply(Integer v) { @Test public void emptyInnerThenSingleBackpressured() { - TestSubscriber ts = new TestSubscriber(1); + TestSubscriber ts = new TestSubscriber<>(1); Flowable.range(1, 2) .concatMapIterable(new Function>() { @@ -454,7 +454,7 @@ public Iterable apply(Integer v) { @Test public void manyEmptyInnerThenSingleBackpressured() { - TestSubscriber ts = new TestSubscriber(1); + TestSubscriber ts = new TestSubscriber<>(1); Flowable.range(1, 1000) .concatMapIterable(new Function>() { @@ -472,7 +472,7 @@ public Iterable apply(Integer v) { @Test public void hasNextIsNotCalledAfterChildUnsubscribedOnNext() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); final AtomicInteger counter = new AtomicInteger(); @@ -523,7 +523,7 @@ public Iterable apply(Integer v) { @Test public void normalPrefetchViaFlatMap() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 5).flatMapIterable(mapper, 2) .subscribe(ts); @@ -827,7 +827,7 @@ public void oneByOne() { @Test public void cancelAfterHasNext() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 3).hide() .flatMapIterable(new Function>() { @@ -974,8 +974,8 @@ public Publisher apply(Flowable f) @Test public void upstreamFusionRejected() { - TestSubscriber ts = new TestSubscriber(); - FlattenIterableSubscriber f = new FlattenIterableSubscriber(ts, + TestSubscriber ts = new TestSubscriber<>(); + FlattenIterableSubscriber f = new FlattenIterableSubscriber<>(ts, Functions.justFunction(Collections.emptyList()), 128); final AtomicLong requested = new AtomicLong(); @@ -1031,8 +1031,8 @@ public void cancel() { public void onErrorLate() { List errors = TestHelper.trackPluginErrors(); try { - TestSubscriberEx ts = new TestSubscriberEx(); - FlattenIterableSubscriber f = new FlattenIterableSubscriber(ts, + TestSubscriberEx ts = new TestSubscriberEx<>(); + FlattenIterableSubscriber f = new FlattenIterableSubscriber<>(ts, Functions.justFunction(Collections.emptyList()), 128); f.onSubscribe(new BooleanSubscription()); @@ -1059,8 +1059,8 @@ public void badRequest() { @Test public void fusedCurrentIteratorEmpty() throws Throwable { - TestSubscriber ts = new TestSubscriber(0); - FlattenIterableSubscriber f = new FlattenIterableSubscriber(ts, + TestSubscriber ts = new TestSubscriber<>(0); + FlattenIterableSubscriber f = new FlattenIterableSubscriber<>(ts, Functions.justFunction(Arrays.asList(1, 2)), 128); f.onSubscribe(new BooleanSubscription()); @@ -1080,8 +1080,8 @@ public void fusedCurrentIteratorEmpty() throws Throwable { @Test public void fusionRequestedState() throws Exception { - TestSubscriber ts = new TestSubscriber(0); - FlattenIterableSubscriber f = new FlattenIterableSubscriber(ts, + TestSubscriber ts = new TestSubscriber<>(0); + FlattenIterableSubscriber f = new FlattenIterableSubscriber<>(ts, Functions.justFunction(Arrays.asList(1, 2)), 128); f.onSubscribe(new BooleanSubscription()); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableForEachTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableForEachTest.java index c643c0652b..d9ff63257c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableForEachTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableForEachTest.java @@ -27,7 +27,7 @@ public class FlowableForEachTest extends RxJavaTest { @Test public void forEachWile() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); Flowable.range(1, 5) .doOnNext(new Consumer() { @@ -48,7 +48,7 @@ public boolean test(Integer v) throws Exception { @Test public void forEachWileWithError() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); Flowable.range(1, 5).concatWith(Flowable.error(new TestException())) .doOnNext(new Consumer() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromArrayTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromArrayTest.java index 62607299d6..d4dda81754 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromArrayTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromArrayTest.java @@ -37,7 +37,7 @@ Flowable create(int n) { @Test public void simple() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); create(1000).subscribe(ts); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCallableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCallableTest.java index cc4b1b64bb..f8f3ed670c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCallableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromCallableTest.java @@ -121,7 +121,7 @@ public String answer(InvocationOnMock invocation) throws Throwable { Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber outer = new TestSubscriber(subscriber); + TestSubscriber outer = new TestSubscriber<>(subscriber); fromCallableFlowable .subscribeOn(Schedulers.computation()) @@ -248,7 +248,7 @@ public Object call() throws Exception { public void undeliverableUponCancellation() throws Exception { List errors = TestHelper.trackPluginErrors(); try { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.fromCallable(new Callable() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromIterableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromIterableTest.java index 1b21baf610..6385d58d95 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromIterableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromIterableTest.java @@ -119,13 +119,13 @@ public void observableFromIterable() { @Test public void backpressureViaRequest() { - ArrayList list = new ArrayList(Flowable.bufferSize()); + ArrayList list = new ArrayList<>(Flowable.bufferSize()); for (int i = 1; i <= Flowable.bufferSize() + 1; i++) { list.add(i); } Flowable f = Flowable.fromIterable(list); - TestSubscriberEx ts = new TestSubscriberEx(0L); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); ts.assertNoValues(); ts.request(1); @@ -145,7 +145,7 @@ public void backpressureViaRequest() { public void noBackpressure() { Flowable f = Flowable.fromIterable(Arrays.asList(1, 2, 3, 4, 5)); - TestSubscriberEx ts = new TestSubscriberEx(0L); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); ts.assertNoValues(); ts.request(Long.MAX_VALUE); // infinite @@ -161,7 +161,7 @@ public void subscribeMultipleTimes() { Flowable f = Flowable.fromIterable(Arrays.asList(1, 2, 3)); for (int i = 0; i < 10; i++) { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); f.subscribe(ts); @@ -333,7 +333,7 @@ public Iterator iterator() { } }; - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.fromIterable(it).subscribe(ts); @@ -366,7 +366,7 @@ public void remove() { } }; - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.fromIterable(it).subscribe(ts); @@ -403,7 +403,7 @@ public void remove() { } }; - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.fromIterable(it).subscribe(ts); @@ -440,7 +440,7 @@ public void remove() { } }; - TestSubscriber ts = new TestSubscriber(5); + TestSubscriber ts = new TestSubscriber<>(5); Flowable.fromIterable(it).subscribe(ts); @@ -473,7 +473,7 @@ public void remove() { } }; - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.fromIterable(it).subscribe(ts); @@ -506,7 +506,7 @@ public void remove() { } }; - TestSubscriber ts = new TestSubscriber(5); + TestSubscriber ts = new TestSubscriber<>(5); Flowable.fromIterable(it).subscribe(ts); @@ -539,7 +539,7 @@ public void remove() { } }; - TestSubscriber ts = new TestSubscriber(5); + TestSubscriber ts = new TestSubscriber<>(5); ts.cancel(); Flowable.fromIterable(it).subscribe(ts); @@ -552,7 +552,7 @@ public void remove() { @Test public void fusionWithConcatMap() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.fromIterable(Arrays.asList(1, 2, 3, 4)).concatMap( new Function>() { @@ -724,7 +724,7 @@ public void normalConditionalLong2() { @Test public void requestRaceConditional() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { - final TestSubscriber ts = new TestSubscriber(0L); + final TestSubscriber ts = new TestSubscriber<>(0L); Runnable r = new Runnable() { @Override @@ -744,7 +744,7 @@ public void run() { @Test public void requestRaceConditional2() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { - final TestSubscriber ts = new TestSubscriber(0L); + final TestSubscriber ts = new TestSubscriber<>(0L); Runnable r = new Runnable() { @Override @@ -764,7 +764,7 @@ public void run() { @Test public void requestCancelConditionalRace() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { - final TestSubscriber ts = new TestSubscriber(0L); + final TestSubscriber ts = new TestSubscriber<>(0L); Runnable r1 = new Runnable() { @Override @@ -791,7 +791,7 @@ public void run() { @Test public void requestCancelConditionalRace2() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { - final TestSubscriber ts = new TestSubscriber(0L); + final TestSubscriber ts = new TestSubscriber<>(0L); Runnable r1 = new Runnable() { @Override @@ -818,7 +818,7 @@ public void run() { @Test public void requestCancelRace() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { - final TestSubscriber ts = new TestSubscriber(0L); + final TestSubscriber ts = new TestSubscriber<>(0L); Runnable r1 = new Runnable() { @Override @@ -844,7 +844,7 @@ public void run() { @Test public void requestCancelRace2() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { - final TestSubscriber ts = new TestSubscriber(0L); + final TestSubscriber ts = new TestSubscriber<>(0L); Runnable r1 = new Runnable() { @Override @@ -933,7 +933,7 @@ public void hasNext2Throws() { @Test public void hasNextCancels() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.fromIterable(new Iterable() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSourceTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSourceTest.java index 76fff6cb82..fefbf1533e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSourceTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSourceTest.java @@ -38,7 +38,7 @@ public class FlowableFromSourceTest extends RxJavaTest { public void before() { source = new PublishAsyncEmitter(); sourceNoCancel = new PublishAsyncEmitterNoCancel(); - ts = new TestSubscriberEx(0L); + ts = new TestSubscriberEx<>(0L); } @Test diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSupplierTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSupplierTest.java index c44954bce3..5753e8ff66 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSupplierTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSupplierTest.java @@ -121,7 +121,7 @@ public String answer(InvocationOnMock invocation) throws Throwable { Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber outer = new TestSubscriber(subscriber); + TestSubscriber outer = new TestSubscriber<>(subscriber); fromSupplierFlowable .subscribeOn(Schedulers.computation()) @@ -248,7 +248,7 @@ public Object get() throws Exception { public void undeliverableUponCancellation() throws Exception { List errors = TestHelper.trackPluginErrors(); try { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.fromSupplier(new Supplier() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupByTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupByTest.java index 5dae57500f..a14372b959 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupByTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupByTest.java @@ -111,7 +111,7 @@ public void error() { final AtomicInteger groupCounter = new AtomicInteger(); final AtomicInteger eventCounter = new AtomicInteger(); - final AtomicReference error = new AtomicReference(); + final AtomicReference error = new AtomicReference<>(); grouped.flatMap(new Function, Flowable>() { @@ -156,13 +156,13 @@ public void onNext(String v) { private static Map> toMap(Flowable> flowable) { - final ConcurrentHashMap> result = new ConcurrentHashMap>(); + final ConcurrentHashMap> result = new ConcurrentHashMap<>(); flowable.doOnNext(new Consumer>() { @Override public void accept(final GroupedFlowable f) { - result.put(f.getKey(), new ConcurrentLinkedQueue()); + result.put(f.getKey(), new ConcurrentLinkedQueue<>()); f.subscribe(new Consumer() { @Override @@ -605,7 +605,7 @@ public void accept(String s) { @Test public void firstGroupsCompleteAndParentSlowToThenEmitFinalGroupsAndThenComplete() throws InterruptedException { final CountDownLatch first = new CountDownLatch(2); // there are two groups to first complete - final ArrayList results = new ArrayList(); + final ArrayList results = new ArrayList<>(); Flowable.unsafeCreate(new Publisher() { @Override @@ -684,7 +684,7 @@ public void accept(String s) { public void firstGroupsCompleteAndParentSlowToThenEmitFinalGroupsWhichThenSubscribesOnAndDelaysAndThenCompletes() throws InterruptedException { System.err.println("----------------------------------------------------------------------------------------------"); final CountDownLatch first = new CountDownLatch(2); // there are two groups to first complete - final ArrayList results = new ArrayList(); + final ArrayList results = new ArrayList<>(); Flowable.unsafeCreate(new Publisher() { @Override @@ -776,7 +776,7 @@ public void accept(String s) { @Test public void firstGroupsCompleteAndParentSlowToThenEmitFinalGroupsWhichThenObservesOnAndDelaysAndThenCompletes() throws InterruptedException { final CountDownLatch first = new CountDownLatch(2); // there are two groups to first complete - final ArrayList results = new ArrayList(); + final ArrayList results = new ArrayList<>(); Flowable.unsafeCreate(new Publisher() { @Override @@ -853,7 +853,7 @@ public void accept(String s) { @Test public void groupsWithNestedSubscribeOn() throws InterruptedException { - final ArrayList results = new ArrayList(); + final ArrayList results = new ArrayList<>(); Flowable.unsafeCreate(new Publisher() { @Override @@ -910,7 +910,7 @@ public void accept(String s) { @Test public void groupsWithNestedObserveOn() throws InterruptedException { - final ArrayList results = new ArrayList(); + final ArrayList results = new ArrayList<>(); Flowable.unsafeCreate(new Publisher() { @Override @@ -1035,7 +1035,7 @@ public Boolean apply(Integer n) { @Test public void groupByBackpressure() throws InterruptedException { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 4000) .groupBy(IS_EVEN2) @@ -1162,7 +1162,7 @@ public String apply(String v) { } }); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); m.subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); System.out.println("ts .get " + ts.values()); @@ -1178,7 +1178,7 @@ public void keySelectorThrows() { Flowable m = source.groupBy(fail(0), dbl).flatMap(FLATTEN_INTEGER); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); m.subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); assertEquals(1, ts.errors().size()); @@ -1190,7 +1190,7 @@ public void valueSelectorThrows() { Flowable source = Flowable.just(0, 1, 2, 3, 4, 5, 6); Flowable m = source.groupBy(identity, fail(0)).flatMap(FLATTEN_INTEGER); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); m.subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); assertEquals(1, ts.errors().size()); @@ -1204,7 +1204,7 @@ public void innerEscapeCompleted() { Flowable m = source.groupBy(identity, dbl).flatMap(FLATTEN_INTEGER); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); m.subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); ts.assertNoErrors(); @@ -1218,7 +1218,7 @@ public void innerEscapeCompleted() { public void exceptionIfSubscribeToChildMoreThanOnce() { Flowable source = Flowable.just(0); - final AtomicReference> inner = new AtomicReference>(); + final AtomicReference> inner = new AtomicReference<>(); Flowable> m = source.groupBy(identity, dbl); @@ -1247,7 +1247,7 @@ public void error2() { Flowable m = source.groupBy(identity, dbl).flatMap(FLATTEN_INTEGER); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); m.subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); assertEquals(1, ts.errors().size()); @@ -1256,7 +1256,7 @@ public void error2() { @Test public void groupByBackpressure3() throws InterruptedException { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 4000).groupBy(IS_EVEN2).flatMap(new Function, Flowable>() { @@ -1313,7 +1313,7 @@ public void accept(Notification t1) { @Test public void groupByBackpressure2() throws InterruptedException { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 4000) .doOnNext(new Consumer() { @@ -1362,7 +1362,7 @@ public Flowable apply(GroupedFlowable t) { @Test public void groupByWithNullKey() { final String[] key = new String[]{"uninitialized"}; - final List values = new ArrayList(); + final List values = new ArrayList<>(); Flowable.just("a", "b", "c").groupBy(new Function() { @Override @@ -1398,7 +1398,7 @@ public void subscribe(Subscriber subscriber) { } } ); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); f.groupBy(new Function() { @@ -1416,11 +1416,11 @@ public Integer apply(Integer integer) { @Test public void groupByShouldPropagateError() { final Throwable e = new RuntimeException("Oops"); - final TestSubscriberEx inner1 = new TestSubscriberEx(); - final TestSubscriberEx inner2 = new TestSubscriberEx(); + final TestSubscriberEx inner1 = new TestSubscriberEx<>(); + final TestSubscriberEx inner2 = new TestSubscriberEx<>(); final TestSubscriberEx> outer - = new TestSubscriberEx>(new DefaultSubscriber>() { + = new TestSubscriberEx<>(new DefaultSubscriber>() { @Override public void onComplete() { @@ -1557,7 +1557,7 @@ public Object apply(Integer i) { */ @Test public void backpressureInnerDoesntOverflowOuter() { - TestSubscriber> ts = new TestSubscriber>(0L); + TestSubscriber> ts = new TestSubscriber<>(0L); PublishProcessor pp = PublishProcessor.create(); @@ -1586,7 +1586,7 @@ public void accept(GroupedFlowable g) { @Test public void backpressureInnerDoesntOverflowOuterMissingBackpressure() { - TestSubscriber> ts = new TestSubscriber>(1); + TestSubscriber> ts = new TestSubscriber<>(1); Flowable.fromArray(1, 2) .groupBy(new Function() { @@ -1611,9 +1611,9 @@ public void accept(GroupedFlowable g) { @Test public void oneGroupInnerRequestsTwiceBuffer() { // FIXME: delayed requesting in groupBy results in group abandonment - TestSubscriber ts1 = new TestSubscriber(1L); + TestSubscriber ts1 = new TestSubscriber<>(1L); - final TestSubscriber ts2 = new TestSubscriber(0L); + final TestSubscriber ts2 = new TestSubscriber<>(0L); Flowable.range(1, Flowable.bufferSize() * 2) .groupBy(new Function() { @@ -1886,7 +1886,7 @@ public Map apply(final Consumer notify) throws Exceptio @Test public void mapFactoryExpiryCompletesGroupedFlowable() { - final List completed = new CopyOnWriteArrayList(); + final List completed = new CopyOnWriteArrayList<>(); Function, Map> evictingMapFactory = createEvictingMapFactorySynchronousOnly(1); PublishSubject subject = PublishSubject.create(); TestSubscriberEx ts = subject.toFlowable(BackpressureStrategy.BUFFER) @@ -1916,7 +1916,7 @@ public Integer apply(Integer n) throws Exception { @Test public void mapFactoryWithExpiringGuavaCacheDemonstrationCodeForUseInJavadoc() { //javadoc will be a version of this using lambdas and without assertions - final List completed = new CopyOnWriteArrayList(); + final List completed = new CopyOnWriteArrayList<>(); //size should be less than 5 to notice the effect Function, Map> evictingMapFactory = createEvictingMapFactoryGuava(3); int numValues = 1000; @@ -1999,7 +1999,7 @@ public void onRemoval(RemovalNotification notification) { } }; - final List list = new CopyOnWriteArrayList(); + final List list = new CopyOnWriteArrayList<>(); Flowable stream = source // .doOnCancel(new Action() { @Override @@ -2091,8 +2091,8 @@ public Publisher apply(GroupedFlowable g) th //not thread safe private static final class SingleThreadEvictingHashMap implements Map { - private final List list = new ArrayList(); - private final Map map = new HashMap(); + private final List list = new ArrayList<>(); + private final Map map = new HashMap<>(); private final int maxSize; private final Consumer evictedListener; @@ -2214,15 +2214,16 @@ private static Function, Map> createEvictingMa @Override public Map apply(final Consumer notify) throws Exception { - return new SingleThreadEvictingHashMap(maxSize, new Consumer() { - @Override - public void accept(Object object) { - try { - notify.accept(object); - } catch (Throwable e) { - throw new RuntimeException(e); - } - }}); + return new SingleThreadEvictingHashMap<>(maxSize, new Consumer() { + @Override + public void accept(Object object) { + try { + notify.accept(object); + } catch (Throwable e) { + throw new RuntimeException(e); + } + } + }); }}; return evictingMapFactory; } @@ -2231,7 +2232,7 @@ public void accept(Object object) { public void cancelOverFlatmapRace() { for (int i = 0; i < TestHelper.RACE_LONG_LOOPS; i++) { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); final PublishProcessor pp = PublishProcessor.create(); @@ -2274,7 +2275,7 @@ public void run() { @Test public void abandonedGroupsNoDataloss() { - final List> groups = new ArrayList>(); + final List> groups = new ArrayList<>(); Flowable.range(1, 1000) .groupBy(new Function() { @@ -2303,8 +2304,8 @@ public void accept(GroupedFlowable v) throws Throwable { @Test public void newGroupValueSelectorFails() { - TestSubscriber ts1 = new TestSubscriber(); - final TestSubscriber ts2 = new TestSubscriber(); + TestSubscriber ts1 = new TestSubscriber<>(); + final TestSubscriber ts2 = new TestSubscriber<>(); Flowable.just(1) .groupBy(Functions.identity(), new Function() { @@ -2330,8 +2331,8 @@ public void accept(GroupedFlowable g) throws Throwable { @Test public void existingGroupValueSelectorFails() { - TestSubscriber ts1 = new TestSubscriber(); - final TestSubscriber ts2 = new TestSubscriber(); + TestSubscriber ts1 = new TestSubscriber<>(); + final TestSubscriber ts2 = new TestSubscriber<>(); Flowable.just(1, 2) .groupBy(Functions.justFunction(1), new Function() { @@ -2399,7 +2400,7 @@ public Integer apply(Integer t) throws Throwable { throw new TestException(); } }) - .subscribeWith(new TestSubscriberEx>(0L)); + .subscribeWith(new TestSubscriberEx<>(0L)); assertTrue(pp.offer(1)); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElementsTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElementsTest.java index e88319a1dd..2558b4a433 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElementsTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElementsTest.java @@ -61,7 +61,7 @@ public void accept(Integer t) { @Test public void completedOkFlowable() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); Flowable.range(1, 10).ignoreElements().toFlowable().subscribe(ts); ts.assertNoErrors(); ts.assertNoValues(); @@ -70,7 +70,7 @@ public void completedOkFlowable() { @Test public void errorReceivedFlowable() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); TestException ex = new TestException("boo"); Flowable.error(ex).ignoreElements().toFlowable().subscribe(ts); ts.assertNoValues(); @@ -173,7 +173,7 @@ public void accept(Integer t) { @Test public void completedOk() { - TestObserverEx to = new TestObserverEx(); + TestObserverEx to = new TestObserverEx<>(); Flowable.range(1, 10).ignoreElements().subscribe(to); to.assertNoErrors(); to.assertNoValues(); @@ -182,7 +182,7 @@ public void completedOk() { @Test public void errorReceived() { - TestObserverEx to = new TestObserverEx(); + TestObserverEx to = new TestObserverEx<>(); TestException ex = new TestException("boo"); Flowable.error(ex).ignoreElements().subscribe(to); to.assertNoValues(); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalTest.java index a5ec88c154..68b8bd59fd 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIntervalTest.java @@ -40,7 +40,7 @@ public void badRequest() { @Test public void cancelledOnRun() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); IntervalSubscriber is = new IntervalSubscriber(ts); ts.onSubscribe(is); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapNotificationTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapNotificationTest.java index 3ec6b8f771..0deec9376b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapNotificationTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapNotificationTest.java @@ -29,7 +29,7 @@ public class FlowableMapNotificationTest extends RxJavaTest { @Test public void just() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.just(1) .flatMap( new Function>() { @@ -61,7 +61,7 @@ public Flowable get() { public void backpressure() { TestSubscriber ts = TestSubscriber.create(0L); - new FlowableMapNotification(Flowable.range(1, 3), + new FlowableMapNotification<>(Flowable.range(1, 3), new Function() { @Override public Integer apply(Integer item) { @@ -105,7 +105,7 @@ public void noBackpressure() { PublishProcessor pp = PublishProcessor.create(); - new FlowableMapNotification(pp, + new FlowableMapNotification<>(pp, new Function() { @Override public Integer apply(Integer item) { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapTest.java index 35dba45e2b..c12aafa21d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMapTest.java @@ -155,7 +155,7 @@ public String apply(Map map) { @Test public void mapWithError() { - final List errors = new ArrayList(); + final List errors = new ArrayList<>(); Flowable w = Flowable.just("one", "fail", "two", "three", "fail"); Flowable m = w.map(new Function() { @@ -261,7 +261,7 @@ public Integer apply(Integer i) { } private static Map getMap(String prefix) { - Map m = new HashMap(); + Map m = new HashMap<>(); m.put("firstName", prefix + "First"); m.put("lastName", prefix + "Last"); return m; @@ -272,7 +272,7 @@ public void functionCrashUnsubscribes() { PublishProcessor pp = PublishProcessor.create(); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); pp.map(new Function() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMaterializeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMaterializeTest.java index a6f63f3cf2..1d798e6272 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMaterializeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMaterializeTest.java @@ -102,7 +102,7 @@ public void multipleSubscribes() throws InterruptedException, ExecutionException @Test public void backpressureOnEmptyStream() { - TestSubscriber> ts = new TestSubscriber>(0L); + TestSubscriber> ts = new TestSubscriber<>(0L); Flowable. empty().materialize().subscribe(ts); ts.assertNoValues(); ts.request(1); @@ -113,7 +113,7 @@ public void backpressureOnEmptyStream() { @Test public void backpressureNoError() { - TestSubscriber> ts = new TestSubscriber>(0L); + TestSubscriber> ts = new TestSubscriber<>(0L); Flowable.just(1, 2, 3).materialize().subscribe(ts); ts.assertNoValues(); ts.request(1); @@ -127,7 +127,7 @@ public void backpressureNoError() { @Test public void backpressureNoErrorAsync() throws InterruptedException { - TestSubscriber> ts = new TestSubscriber>(0L); + TestSubscriber> ts = new TestSubscriber<>(0L); Flowable.just(1, 2, 3) .materialize() .subscribeOn(Schedulers.computation()) @@ -148,7 +148,7 @@ public void backpressureNoErrorAsync() throws InterruptedException { @Test public void backpressureWithError() { - TestSubscriber> ts = new TestSubscriber>(0L); + TestSubscriber> ts = new TestSubscriber<>(0L); Flowable. error(new IllegalArgumentException()).materialize().subscribe(ts); ts.assertNoValues(); ts.request(1); @@ -158,7 +158,7 @@ public void backpressureWithError() { @Test public void backpressureWithEmissionThenError() { - TestSubscriber> ts = new TestSubscriber>(0L); + TestSubscriber> ts = new TestSubscriber<>(0L); IllegalArgumentException ex = new IllegalArgumentException(); Flowable.fromIterable(Arrays.asList(1)).concatWith(Flowable. error(ex)).materialize() .subscribe(ts); @@ -175,7 +175,7 @@ public void backpressureWithEmissionThenError() { @Test public void withCompletionCausingError() { - TestSubscriberEx> ts = new TestSubscriberEx>(); + TestSubscriberEx> ts = new TestSubscriberEx<>(); final RuntimeException ex = new RuntimeException("boo"); Flowable.empty().materialize().doOnNext(new Consumer() { @Override @@ -190,7 +190,7 @@ public void accept(Object t) { @Test public void unsubscribeJustBeforeCompletionNotificationShouldPreventThatNotificationArriving() { - TestSubscriber> ts = new TestSubscriber>(0L); + TestSubscriber> ts = new TestSubscriber<>(0L); Flowable.empty().materialize() .subscribe(ts); @@ -204,7 +204,7 @@ private static class TestNotificationSubscriber extends DefaultSubscriber> notifications = new Vector>(); + List> notifications = new Vector<>(); @Override public void onComplete() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeDelayErrorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeDelayErrorTest.java index f80323abdd..7a528e8cb2 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeDelayErrorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeDelayErrorTest.java @@ -257,7 +257,7 @@ public void mergeArray() { public void mergeList() { final Flowable f1 = Flowable.unsafeCreate(new TestSynchronousFlowable()); final Flowable f2 = Flowable.unsafeCreate(new TestSynchronousFlowable()); - List> listOfFlowables = new ArrayList>(); + List> listOfFlowables = new ArrayList<>(); listOfFlowables.add(f1); listOfFlowables.add(f2); @@ -438,7 +438,7 @@ public void onNext(String args) { @Test public void errorInParentFlowable() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); Flowable.mergeDelayError( Flowable.just(Flowable.just(1), Flowable.just(2)) .startWithItem(Flowable. error(new RuntimeException())) @@ -467,7 +467,7 @@ public void subscribe(Subscriber> op) { stringSubscriber = TestHelper.mockSubscriber(); - TestSubscriberEx ts = new TestSubscriberEx(stringSubscriber); + TestSubscriberEx ts = new TestSubscriberEx<>(stringSubscriber); Flowable m = Flowable.mergeDelayError(parentFlowable); m.subscribe(ts); System.out.println("testErrorInParentFlowableDelayed | " + i); @@ -506,7 +506,7 @@ public void run() { @Test public void delayErrorMaxConcurrent() { - final List requests = new ArrayList(); + final List requests = new ArrayList<>(); Flowable source = Flowable.mergeDelayError(Flowable.just( Flowable.just(1).hide(), Flowable.error(new TestException())) @@ -517,7 +517,7 @@ public void accept(long t1) { } }), 1); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); source.subscribe(ts); @@ -532,7 +532,7 @@ public void accept(long t1) { public void mergeIterable() { final Flowable f1 = Flowable.unsafeCreate(new TestSynchronousFlowable()); final Flowable f2 = Flowable.unsafeCreate(new TestSynchronousFlowable()); - List> listOfFlowables = new ArrayList>(); + List> listOfFlowables = new ArrayList<>(); listOfFlowables.add(f1); listOfFlowables.add(f2); @@ -574,7 +574,7 @@ public void iterableMaxConcurrent() { @SuppressWarnings("unchecked") @Test public void iterableMaxConcurrentError() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); PublishProcessor pp1 = PublishProcessor.create(); PublishProcessor pp2 = PublishProcessor.create(); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeMaxConcurrentTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeMaxConcurrentTest.java index 979c29a9aa..b2582430bb 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeMaxConcurrentTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeMaxConcurrentTest.java @@ -34,14 +34,14 @@ public class FlowableMergeMaxConcurrentTest extends RxJavaTest { @Test public void whenMaxConcurrentIsOne() { for (int i = 0; i < 100; i++) { - List> os = new ArrayList>(); + List> os = new ArrayList<>(); os.add(Flowable.just("one", "two", "three", "four", "five").subscribeOn(Schedulers.newThread())); os.add(Flowable.just("one", "two", "three", "four", "five").subscribeOn(Schedulers.newThread())); os.add(Flowable.just("one", "two", "three", "four", "five").subscribeOn(Schedulers.newThread())); List expected = Arrays.asList("one", "two", "three", "four", "five", "one", "two", "three", "four", "five", "one", "two", "three", "four", "five"); Iterator iter = Flowable.merge(os, 1).blockingIterable().iterator(); - List actual = new ArrayList(); + List actual = new ArrayList<>(); while (iter.hasNext()) { actual.add(iter.next()); } @@ -57,8 +57,8 @@ public void maxConcurrent() { int maxConcurrent = 2 + (times % 10); AtomicInteger subscriptionCount = new AtomicInteger(0); - List> os = new ArrayList>(); - List scos = new ArrayList(); + List> os = new ArrayList<>(); + List scos = new ArrayList<>(); for (int i = 0; i < observableCount; i++) { SubscriptionCheckObservable sco = new SubscriptionCheckObservable(subscriptionCount, maxConcurrent); scos.add(sco); @@ -66,7 +66,7 @@ public void maxConcurrent() { } Iterator iter = Flowable.merge(os, maxConcurrent).blockingIterable().iterator(); - List actual = new ArrayList(); + List actual = new ArrayList<>(); while (iter.hasNext()) { actual.add(iter.next()); } @@ -118,7 +118,7 @@ public void run() { @Test public void mergeALotOfSourcesOneByOneSynchronously() { int n = 10000; - List> sourceList = new ArrayList>(n); + List> sourceList = new ArrayList<>(n); for (int i = 0; i < n; i++) { sourceList.add(Flowable.just(i)); } @@ -134,7 +134,7 @@ public void mergeALotOfSourcesOneByOneSynchronously() { @Test public void mergeALotOfSourcesOneByOneSynchronouslyTakeHalf() { int n = 10000; - List> sourceList = new ArrayList>(n); + List> sourceList = new ArrayList<>(n); for (int i = 0; i < n; i++) { sourceList.add(Flowable.just(i)); } @@ -150,9 +150,9 @@ public void mergeALotOfSourcesOneByOneSynchronouslyTakeHalf() { @Test public void simple() { for (int i = 1; i < 100; i++) { - TestSubscriberEx ts = new TestSubscriberEx(); - List> sourceList = new ArrayList>(i); - List result = new ArrayList(i); + TestSubscriberEx ts = new TestSubscriberEx<>(); + List> sourceList = new ArrayList<>(i); + List result = new ArrayList<>(i); for (int j = 1; j <= i; j++) { sourceList.add(Flowable.just(j)); result.add(j); @@ -169,9 +169,9 @@ public void simple() { @Test public void simpleOneLess() { for (int i = 2; i < 100; i++) { - TestSubscriberEx ts = new TestSubscriberEx(); - List> sourceList = new ArrayList>(i); - List result = new ArrayList(i); + TestSubscriberEx ts = new TestSubscriberEx<>(); + List> sourceList = new ArrayList<>(i); + List result = new ArrayList<>(i); for (int j = 1; j <= i; j++) { sourceList.add(Flowable.just(j)); result.add(j); @@ -201,9 +201,9 @@ public void simpleAsyncLoop() { @Test public void simpleAsync() { for (int i = 1; i < 50; i++) { - TestSubscriber ts = new TestSubscriber(); - List> sourceList = new ArrayList>(i); - Set expected = new HashSet(i); + TestSubscriber ts = new TestSubscriber<>(); + List> sourceList = new ArrayList<>(i); + Set expected = new HashSet<>(i); for (int j = 1; j <= i; j++) { sourceList.add(Flowable.just(j).subscribeOn(Schedulers.io())); expected.add(j); @@ -213,7 +213,7 @@ public void simpleAsync() { ts.awaitDone(1, TimeUnit.SECONDS); ts.assertNoErrors(); - Set actual = new HashSet(ts.values()); + Set actual = new HashSet<>(ts.values()); assertEquals(expected, actual); } @@ -233,9 +233,9 @@ public void simpleOneLessAsync() { if (System.currentTimeMillis() - t > TimeUnit.SECONDS.toMillis(9)) { break; } - TestSubscriber ts = new TestSubscriber(); - List> sourceList = new ArrayList>(i); - Set expected = new HashSet(i); + TestSubscriber ts = new TestSubscriber<>(); + List> sourceList = new ArrayList<>(i); + Set expected = new HashSet<>(i); for (int j = 1; j <= i; j++) { sourceList.add(Flowable.just(j).subscribeOn(Schedulers.io())); expected.add(j); @@ -245,7 +245,7 @@ public void simpleOneLessAsync() { ts.awaitDone(1, TimeUnit.SECONDS); ts.assertNoErrors(); - Set actual = new HashSet(ts.values()); + Set actual = new HashSet<>(ts.values()); assertEquals(expected, actual); } @@ -253,7 +253,7 @@ public void simpleOneLessAsync() { @Test public void backpressureHonored() throws Exception { - List> sourceList = new ArrayList>(3); + List> sourceList = new ArrayList<>(3); sourceList.add(Flowable.range(0, 100000).subscribeOn(Schedulers.io())); sourceList.add(Flowable.range(0, 100000).subscribeOn(Schedulers.io())); @@ -284,13 +284,13 @@ public void onNext(Integer t) { @Test public void take() throws Exception { - List> sourceList = new ArrayList>(3); + List> sourceList = new ArrayList<>(3); sourceList.add(Flowable.range(0, 100000).subscribeOn(Schedulers.io())); sourceList.add(Flowable.range(0, 100000).subscribeOn(Schedulers.io())); sourceList.add(Flowable.range(0, 100000).subscribeOn(Schedulers.io())); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.merge(sourceList, 2).take(5).subscribe(ts); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeTest.java index 22526d1922..6b3f72e2f9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeTest.java @@ -115,7 +115,7 @@ public void mergeArray() { public void mergeList() { final Flowable f1 = Flowable.unsafeCreate(new TestSynchronousFlowable()); final Flowable f2 = Flowable.unsafeCreate(new TestSynchronousFlowable()); - List> listOfFlowables = new ArrayList>(); + List> listOfFlowables = new ArrayList<>(); listOfFlowables.add(f1); listOfFlowables.add(f2); @@ -201,7 +201,7 @@ public void mergeArrayWithThreading() { final TestASynchronousFlowable f2 = new TestASynchronousFlowable(); Flowable m = Flowable.merge(Flowable.unsafeCreate(f1), Flowable.unsafeCreate(f2)); - TestSubscriber ts = new TestSubscriber(stringSubscriber); + TestSubscriber ts = new TestSubscriber<>(stringSubscriber); m.subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); @@ -231,7 +231,7 @@ public void synchronizationOfMultipleSequences() throws Throwable { final AtomicInteger concurrentCounter = new AtomicInteger(); final AtomicInteger totalCounter = new AtomicInteger(); - final AtomicReference error = new AtomicReference(); + final AtomicReference error = new AtomicReference<>(); Flowable m = Flowable.merge(Flowable.unsafeCreate(f1), Flowable.unsafeCreate(f2)); m.subscribe(new DefaultSubscriber() { @@ -424,7 +424,7 @@ public void unsubscribeAsFlowablesComplete() { AtomicBoolean os2 = new AtomicBoolean(false); Flowable f2 = createFlowableOf5IntervalsOf1SecondIncrementsWithSubscriptionHook(scheduler2, os2); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); Flowable.merge(f1, f2).subscribe(ts); // we haven't incremented time so nothing should be received yet @@ -466,7 +466,7 @@ public void earlyUnsubscribe() { AtomicBoolean os2 = new AtomicBoolean(false); Flowable f2 = createFlowableOf5IntervalsOf1SecondIncrementsWithSubscriptionHook(scheduler2, os2); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.merge(f1, f2).subscribe(ts); // we haven't incremented time so nothing should be received yet @@ -542,7 +542,7 @@ public void concurrency() { for (int i = 0; i < 10; i++) { Flowable merge = Flowable.merge(f.onBackpressureBuffer(), f.onBackpressureBuffer(), f.onBackpressureBuffer()); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); merge.subscribe(ts); ts.awaitDone(3, TimeUnit.SECONDS); @@ -595,7 +595,7 @@ public void run() { for (int i = 0; i < 10; i++) { Flowable merge = Flowable.merge(f, f, f); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); merge.subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); @@ -642,7 +642,7 @@ public void run() { for (int i = 0; i < 10; i++) { Flowable merge = Flowable.merge(f.onBackpressureBuffer(), f.onBackpressureBuffer(), f.onBackpressureBuffer()); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); merge.subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); @@ -866,7 +866,7 @@ public void onNext(Integer t) { @Test public void merge1AsyncStreamOf1() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); mergeNAsyncStreamsOfN(1, 1).subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); ts.assertNoErrors(); @@ -875,7 +875,7 @@ public void merge1AsyncStreamOf1() { @Test public void merge1AsyncStreamOf1000() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); mergeNAsyncStreamsOfN(1, 1000).subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); ts.assertNoErrors(); @@ -884,7 +884,7 @@ public void merge1AsyncStreamOf1000() { @Test public void merge10AsyncStreamOf1000() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); mergeNAsyncStreamsOfN(10, 1000).subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); ts.assertNoErrors(); @@ -893,7 +893,7 @@ public void merge10AsyncStreamOf1000() { @Test public void merge1000AsyncStreamOf1000() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); mergeNAsyncStreamsOfN(1000, 1000).subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); ts.assertNoErrors(); @@ -902,7 +902,7 @@ public void merge1000AsyncStreamOf1000() { @Test public void merge2000AsyncStreamOf100() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); mergeNAsyncStreamsOfN(2000, 100).subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); ts.assertNoErrors(); @@ -911,7 +911,7 @@ public void merge2000AsyncStreamOf100() { @Test public void merge100AsyncStreamOf1() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); mergeNAsyncStreamsOfN(100, 1).subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); ts.assertNoErrors(); @@ -933,7 +933,7 @@ public Flowable apply(Integer i) { @Test public void merge1SyncStreamOf1() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); mergeNSyncStreamsOfN(1, 1).subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); ts.assertNoErrors(); @@ -942,7 +942,7 @@ public void merge1SyncStreamOf1() { @Test public void merge1SyncStreamOf1000000() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); mergeNSyncStreamsOfN(1, 1000000).subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); ts.assertNoErrors(); @@ -951,7 +951,7 @@ public void merge1SyncStreamOf1000000() { @Test public void merge1000SyncStreamOf1000() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); mergeNSyncStreamsOfN(1000, 1000).subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); ts.assertNoErrors(); @@ -960,7 +960,7 @@ public void merge1000SyncStreamOf1000() { @Test public void merge10000SyncStreamOf10() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); mergeNSyncStreamsOfN(10000, 10).subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); ts.assertNoErrors(); @@ -969,7 +969,7 @@ public void merge10000SyncStreamOf10() { @Test public void merge1000000SyncStreamOf1() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); mergeNSyncStreamsOfN(1000000, 1).subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); ts.assertNoErrors(); @@ -1016,7 +1016,7 @@ public boolean hasNext() { @Test public void mergeManyAsyncSingle() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable> os = Flowable.range(1, 10000) .map(new Function>() { @@ -1051,7 +1051,7 @@ public void subscribe(Subscriber s) { @Test public void shouldCompleteAfterApplyingBackpressure_NormalPath() { Flowable source = Flowable.mergeDelayError(Flowable.just(Flowable.range(1, 2))); - TestSubscriberEx subscriber = new TestSubscriberEx(0L); + TestSubscriberEx subscriber = new TestSubscriberEx<>(0L); source.subscribe(subscriber); subscriber.request(3); // 1, 2, - with request(2) we get the 1 and 2 but not the subscriber.assertValues(1, 2); @@ -1061,7 +1061,7 @@ public void shouldCompleteAfterApplyingBackpressure_NormalPath() { @Test public void shouldCompleteAfterApplyingBackpressure_FastPath() { Flowable source = Flowable.mergeDelayError(Flowable.just(Flowable.just(1))); - TestSubscriberEx subscriber = new TestSubscriberEx(0L); + TestSubscriberEx subscriber = new TestSubscriberEx<>(0L); source.subscribe(subscriber); subscriber.request(2); // 1, - should work as per .._NormalPath above subscriber.assertValue(1); @@ -1072,7 +1072,7 @@ public void shouldCompleteAfterApplyingBackpressure_FastPath() { public void shouldNotCompleteIfThereArePendingScalarSynchronousEmissionsWhenTheLastInnerSubscriberCompletes() { TestScheduler scheduler = new TestScheduler(); Flowable source = Flowable.mergeDelayError(Flowable.just(1L), Flowable.timer(1, TimeUnit.SECONDS, scheduler).skip(1)); - TestSubscriberEx subscriber = new TestSubscriberEx(0L); + TestSubscriberEx subscriber = new TestSubscriberEx<>(0L); source.subscribe(subscriber); scheduler.advanceTimeBy(1, TimeUnit.SECONDS); subscriber.assertNoValues(); @@ -1089,7 +1089,7 @@ public void shouldNotCompleteIfThereArePendingScalarSynchronousEmissionsWhenTheL public void delayedErrorsShouldBeEmittedWhenCompleteAfterApplyingBackpressure_NormalPath() { Throwable exception = new Throwable(); Flowable source = Flowable.mergeDelayError(Flowable.range(1, 2), Flowable.error(exception)); - TestSubscriberEx subscriber = new TestSubscriberEx(0L); + TestSubscriberEx subscriber = new TestSubscriberEx<>(0L); source.subscribe(subscriber); subscriber.request(3); // 1, 2, subscriber.assertValues(1, 2); @@ -1101,7 +1101,7 @@ public void delayedErrorsShouldBeEmittedWhenCompleteAfterApplyingBackpressure_No public void delayedErrorsShouldBeEmittedWhenCompleteAfterApplyingBackpressure_FastPath() { Throwable exception = new Throwable(); Flowable source = Flowable.mergeDelayError(Flowable.just(1), Flowable.error(exception)); - TestSubscriberEx subscriber = new TestSubscriberEx(0L); + TestSubscriberEx subscriber = new TestSubscriberEx<>(0L); source.subscribe(subscriber); subscriber.request(2); // 1, subscriber.assertValue(1); @@ -1112,7 +1112,7 @@ public void delayedErrorsShouldBeEmittedWhenCompleteAfterApplyingBackpressure_Fa @Test public void shouldNotCompleteWhileThereAreStillScalarSynchronousEmissionsInTheQueue() { Flowable source = Flowable.merge(Flowable.just(1), Flowable.just(2)); - TestSubscriber subscriber = new TestSubscriber(1L); + TestSubscriber subscriber = new TestSubscriber<>(1L); source.subscribe(subscriber); subscriber.assertValue(1); subscriber.request(1); @@ -1123,7 +1123,7 @@ public void shouldNotCompleteWhileThereAreStillScalarSynchronousEmissionsInTheQu public void shouldNotReceivedDelayedErrorWhileThereAreStillScalarSynchronousEmissionsInTheQueue() { Throwable exception = new Throwable(); Flowable source = Flowable.mergeDelayError(Flowable.just(1), Flowable.just(2), Flowable.error(exception)); - TestSubscriberEx subscriber = new TestSubscriberEx(0L); + TestSubscriberEx subscriber = new TestSubscriberEx<>(0L); subscriber.request(1); source.subscribe(subscriber); subscriber.assertValue(1); @@ -1137,7 +1137,7 @@ public void shouldNotReceivedDelayedErrorWhileThereAreStillScalarSynchronousEmis public void shouldNotReceivedDelayedErrorWhileThereAreStillNormalEmissionsInTheQueue() { Throwable exception = new Throwable(); Flowable source = Flowable.mergeDelayError(Flowable.range(1, 2), Flowable.range(3, 2), Flowable.error(exception)); - TestSubscriberEx subscriber = new TestSubscriberEx(0L); + TestSubscriberEx subscriber = new TestSubscriberEx<>(0L); subscriber.request(3); source.subscribe(subscriber); subscriber.assertValues(1, 2, 3); @@ -1152,7 +1152,7 @@ public void mergeKeepsRequesting() throws InterruptedException { //for (int i = 0; i < 5000; i++) { //System.out.println(i + "......................................................................."); final CountDownLatch latch = new CountDownLatch(1); - final ConcurrentLinkedQueue messages = new ConcurrentLinkedQueue(); + final ConcurrentLinkedQueue messages = new ConcurrentLinkedQueue<>(); Flowable.range(1, 2) // produce many integers per second @@ -1280,7 +1280,7 @@ public Flowable apply(Integer t) { ; void runMerge(Function> func, TestSubscriberEx ts) { - List list = new ArrayList(); + List list = new ArrayList<>(); for (int i = 0; i < 1000; i++) { list.add(i); } @@ -1298,12 +1298,12 @@ void runMerge(Function> func, TestSubscriberEx()); + runMerge(toScalar, new TestSubscriberEx<>()); } @Test public void fastMergeHiddenScalar() { - runMerge(toHiddenScalar, new TestSubscriberEx()); + runMerge(toHiddenScalar, new TestSubscriberEx<>()); } @Test @@ -1466,7 +1466,7 @@ public void flatMapMaxConcurrentJustRange() { public void noInnerReordering() { TestSubscriber ts = TestSubscriber.create(0); FlowableFlatMap.MergeSubscriber, Integer> ms = - new FlowableFlatMap.MergeSubscriber, Integer>(ts, Functions.>identity(), false, 128, 128); + new FlowableFlatMap.MergeSubscriber<>(ts, Functions.>identity(), false, 128, 128); ms.onSubscribe(new BooleanSubscription()); PublishProcessor pp = PublishProcessor.create(); @@ -1488,7 +1488,7 @@ public void noInnerReordering() { public void noOuterScalarReordering() { TestSubscriber ts = TestSubscriber.create(0); FlowableFlatMap.MergeSubscriber, Integer> ms = - new FlowableFlatMap.MergeSubscriber, Integer>(ts, Functions.>identity(), false, 128, 128); + new FlowableFlatMap.MergeSubscriber<>(ts, Functions.>identity(), false, 128, 128); ms.onSubscribe(new BooleanSubscription()); ms.onNext(Flowable.just(1)); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithCompletableTest.java index 9008168d48..c074796be6 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithCompletableTest.java @@ -29,7 +29,7 @@ public class FlowableMergeWithCompletableTest extends RxJavaTest { @Test public void normal() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 5).mergeWith( Completable.fromAction(new Action() { @@ -71,7 +71,7 @@ public void cancel() { @Test public void normalBackpressured() { - final TestSubscriber ts = new TestSubscriber(0L); + final TestSubscriber ts = new TestSubscriber<>(0L); Flowable.range(1, 5).mergeWith( Completable.fromAction(new Action() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithMaybeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithMaybeTest.java index 604daa4950..e5ef48a426 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithMaybeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithMaybeTest.java @@ -230,7 +230,7 @@ public void onSuccessFastPathBackpressuredRace() { final PublishProcessor pp = PublishProcessor.create(); final MaybeSubject cs = MaybeSubject.create(); - final TestSubscriber ts = pp.mergeWith(cs).subscribeWith(new TestSubscriber(0)); + final TestSubscriber ts = pp.mergeWith(cs).subscribeWith(new TestSubscriber<>(0)); Runnable r1 = new Runnable() { @Override @@ -259,7 +259,7 @@ public void run() { public void onErrorMainOverflow() { List errors = TestHelper.trackPluginErrors(); try { - final AtomicReference> subscriber = new AtomicReference>(); + final AtomicReference> subscriber = new AtomicReference<>(); TestSubscriber ts = new Flowable() { @Override protected void subscribeActual(Subscriber s) { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithSingleTest.java index 4c5cd09d5b..a48ee16fef 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithSingleTest.java @@ -87,7 +87,7 @@ public void cancel() { @Test public void normalBackpressured() { - final TestSubscriber ts = new TestSubscriber(0L); + final TestSubscriber ts = new TestSubscriber<>(0L); Flowable.range(1, 5).mergeWith( Single.just(100) @@ -226,7 +226,7 @@ public void onSuccessFastPathBackpressuredRace() { final PublishProcessor pp = PublishProcessor.create(); final SingleSubject cs = SingleSubject.create(); - final TestSubscriber ts = pp.mergeWith(cs).subscribeWith(new TestSubscriber(0)); + final TestSubscriber ts = pp.mergeWith(cs).subscribeWith(new TestSubscriber<>(0)); Runnable r1 = new Runnable() { @Override @@ -255,7 +255,7 @@ public void run() { public void onErrorMainOverflow() { List errors = TestHelper.trackPluginErrors(); try { - final AtomicReference> subscriber = new AtomicReference>(); + final AtomicReference> subscriber = new AtomicReference<>(); TestSubscriber ts = new Flowable() { @Override protected void subscribeActual(Subscriber s) { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableObserveOnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableObserveOnTest.java index 994926b237..73efdfc426 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableObserveOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableObserveOnTest.java @@ -65,7 +65,7 @@ public void ordering() throws InterruptedException { Subscriber subscriber = TestHelper.mockSubscriber(); InOrder inOrder = inOrder(subscriber); - TestSubscriberEx ts = new TestSubscriberEx(subscriber); + TestSubscriberEx ts = new TestSubscriberEx<>(subscriber); obs.observeOn(Schedulers.computation()).subscribe(ts); @@ -384,7 +384,7 @@ public void afterUnsubscribeCalledThenObserverOnNextNeverCalled() { final TestScheduler testScheduler = new TestScheduler(); final Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); Flowable.just(1, 2, 3) .observeOn(testScheduler) @@ -519,7 +519,7 @@ public boolean hasNext() { } }); - TestSubscriber testSubscriber = new TestSubscriber(); + TestSubscriber testSubscriber = new TestSubscriber<>(); flowable .take(7) .observeOn(Schedulers.newThread()) @@ -547,7 +547,7 @@ public void subscribe(Subscriber subscriber) { }); - TestSubscriberEx testSubscriber = new TestSubscriberEx(new DefaultSubscriber() { + TestSubscriberEx testSubscriber = new TestSubscriberEx<>(new DefaultSubscriber() { @Override public void onComplete() { @@ -590,7 +590,7 @@ public void onNext(Integer t) { @Test public void asyncChild() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(0, 100000).observeOn(Schedulers.newThread()).observeOn(Schedulers.newThread()).subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); ts.assertNoErrors(); @@ -602,7 +602,7 @@ public void onErrorCutsAheadOfOnNext() { final PublishProcessor processor = PublishProcessor.create(); final AtomicLong counter = new AtomicLong(); - TestSubscriberEx ts = new TestSubscriberEx(new DefaultSubscriber() { + TestSubscriberEx ts = new TestSubscriberEx<>(new DefaultSubscriber() { @Override public void onComplete() { @@ -649,7 +649,7 @@ public void onNext(Long t) { */ @Test public void hotOperatorBackpressure() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); Flowable.interval(0, 1, TimeUnit.MICROSECONDS) .observeOn(Schedulers.computation()) .map(new Function() { @@ -697,7 +697,7 @@ public void accept(Notification n) { }); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); Flowable.combineLatest(timer, Flowable. never(), new BiFunction() { @@ -757,7 +757,7 @@ public void onNext(Integer t) { @Test public void noMoreRequestsAfterUnsubscribe() throws InterruptedException { final CountDownLatch latch = new CountDownLatch(1); - final List requests = Collections.synchronizedList(new ArrayList()); + final List requests = Collections.synchronizedList(new ArrayList<>()); Flowable.range(1, 1000000) .doOnRequest(new LongConsumer() { @@ -873,7 +873,7 @@ public void fixedReplenishPattern() { TestScheduler test = new TestScheduler(); - final List requests = new ArrayList(); + final List requests = new ArrayList<>(); Flowable.range(1, 100) .doOnRequest(new LongConsumer() { @@ -918,9 +918,9 @@ public void bufferSizesWork() { @Test public void synchronousRebatching() { - final List requests = new ArrayList(); + final List requests = new ArrayList<>(); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 50) .doOnRequest(new LongConsumer() { @@ -1594,7 +1594,7 @@ public void onNext(Integer t) { @Test public void syncFusedCancelAfterRequest2() { - final TestSubscriber ts = new TestSubscriber(2L); + final TestSubscriber ts = new TestSubscriber<>(2L); Flowable.range(1, 2) .observeOn(Schedulers.single()) @@ -1630,7 +1630,7 @@ public void onNext(Integer t) { @Test public void syncFusedCancelAfterRequestConditional2() { - final TestSubscriber ts = new TestSubscriber(2L); + final TestSubscriber ts = new TestSubscriber<>(2L); Flowable.range(1, 2) .observeOn(Schedulers.single()) @@ -1644,7 +1644,7 @@ public void syncFusedCancelAfterRequestConditional2() { @Test public void nonFusedCancelAfterRequestConditional2() { - final TestSubscriber ts = new TestSubscriber(2L); + final TestSubscriber ts = new TestSubscriber<>(2L); Flowable.range(1, 2).hide() .observeOn(Schedulers.single()) diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferStrategyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferStrategyTest.java index 91a2b3b7c5..327078ad60 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferStrategyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferStrategyTest.java @@ -58,7 +58,7 @@ public void run() throws Exception { } private TestSubscriber createTestSubscriber() { - return new TestSubscriber(new DefaultSubscriber() { + return new TestSubscriber<>(new DefaultSubscriber() { @Override protected void onStart() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferTest.java index 3d32d2c808..a877b1a390 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferTest.java @@ -39,7 +39,7 @@ public class FlowableOnBackpressureBufferTest extends RxJavaTest { @Test public void noBackpressureSupport() { - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); // this will be ignored ts.request(100); // we take 500 so it unsubscribes @@ -53,7 +53,7 @@ public void noBackpressureSupport() { public void fixBackpressureWithBuffer() throws InterruptedException { final CountDownLatch l1 = new CountDownLatch(100); final CountDownLatch l2 = new CountDownLatch(150); - TestSubscriber ts = new TestSubscriber(new DefaultSubscriber() { + TestSubscriber ts = new TestSubscriber<>(new DefaultSubscriber() { @Override protected void onStart() { @@ -110,17 +110,19 @@ public void fixBackpressureBufferZeroCapacity() throws InterruptedException { public void fixBackpressureBoundedBuffer() throws InterruptedException { final CountDownLatch l1 = new CountDownLatch(100); final CountDownLatch backpressureCallback = new CountDownLatch(1); - TestSubscriber ts = new TestSubscriber(new DefaultSubscriber() { + TestSubscriber ts = new TestSubscriber<>(new DefaultSubscriber() { @Override protected void onStart() { } @Override - public void onComplete() { } + public void onComplete() { + } @Override - public void onError(Throwable e) { } + public void onError(Throwable e) { + } @Override public void onNext(Long t) { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureDropTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureDropTest.java index dabf934ce3..811e27f766 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureDropTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureDropTest.java @@ -32,7 +32,7 @@ public class FlowableOnBackpressureDropTest extends RxJavaTest { @Test public void noBackpressureSupport() { - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); // this will be ignored ts.request(100); // we take 500 so it unsubscribes @@ -44,7 +44,7 @@ public void noBackpressureSupport() { @Test public void withObserveOn() throws InterruptedException { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(0, Flowable.bufferSize() * 10).onBackpressureDrop().observeOn(Schedulers.io()).subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); } @@ -53,7 +53,7 @@ public void withObserveOn() throws InterruptedException { public void fixBackpressureWithBuffer() throws InterruptedException { final CountDownLatch l1 = new CountDownLatch(100); final CountDownLatch l2 = new CountDownLatch(150); - TestSubscriber ts = new TestSubscriber(new DefaultSubscriber() { + TestSubscriber ts = new TestSubscriber<>(new DefaultSubscriber() { @Override protected void onStart() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureErrorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureErrorTest.java index a2288abcb1..76fad7bf49 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureErrorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureErrorTest.java @@ -37,7 +37,7 @@ public void doubleOnSubscribe() { TestHelper.checkDoubleOnSubscribeFlowable(new Function, Publisher>() { @Override public Publisher apply(Flowable f) throws Exception { - return new FlowableOnBackpressureError(f); + return new FlowableOnBackpressureError<>(f); } }); } @@ -47,7 +47,7 @@ public void badSource() { TestHelper.checkBadSourceFlowable(new Function, Object>() { @Override public Object apply(Flowable f) throws Exception { - return new FlowableOnBackpressureError(f); + return new FlowableOnBackpressureError<>(f); } }, false, 1, 1, 1); } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureLatestTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureLatestTest.java index bb52136b0e..438ebb1415 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureLatestTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureLatestTest.java @@ -30,7 +30,7 @@ public class FlowableOnBackpressureLatestTest extends RxJavaTest { @Test public void simple() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); Flowable.range(1, 5).onBackpressureLatest().subscribe(ts); @@ -41,7 +41,7 @@ public void simple() { @Test public void simpleError() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); Flowable.range(1, 5).concatWith(Flowable.error(new TestException())) .onBackpressureLatest().subscribe(ts); @@ -53,7 +53,7 @@ public void simpleError() { @Test public void simpleBackpressure() { - TestSubscriber ts = new TestSubscriber(2L); + TestSubscriber ts = new TestSubscriber<>(2L); Flowable.range(1, 5).onBackpressureLatest().subscribe(ts); @@ -65,7 +65,7 @@ public void simpleBackpressure() { @Test public void synchronousDrop() { PublishProcessor source = PublishProcessor.create(); - TestSubscriberEx ts = new TestSubscriberEx(0L); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); source.onBackpressureLatest().subscribe(ts); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorResumeNextViaFlowableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorResumeNextViaFlowableTest.java index 742b1e5853..b8829893fa 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorResumeNextViaFlowableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorResumeNextViaFlowableTest.java @@ -148,7 +148,7 @@ public void run() { @Test public void backpressure() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(0, 100000) .onErrorResumeWith(Flowable.just(1)) .observeOn(Schedulers.computation()) diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorResumeNextViaFunctionTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorResumeNextViaFunctionTest.java index 72a0bf0161..51de11ae7b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorResumeNextViaFunctionTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorResumeNextViaFunctionTest.java @@ -39,7 +39,7 @@ public class FlowableOnErrorResumeNextViaFunctionTest extends RxJavaTest { @Test public void resumeNextWithSynchronousExecution() { - final AtomicReference receivedException = new AtomicReference(); + final AtomicReference receivedException = new AtomicReference<>(); Flowable w = Flowable.unsafeCreate(new Publisher() { @Override @@ -79,7 +79,7 @@ public Flowable apply(Throwable t1) { @Test public void resumeNextWithAsyncExecution() { - final AtomicReference receivedException = new AtomicReference(); + final AtomicReference receivedException = new AtomicReference<>(); Subscription s = mock(Subscription.class); TestFlowable w = new TestFlowable(s, "one"); Function> resume = new Function>() { @@ -176,7 +176,7 @@ public Flowable apply(Throwable t1) { Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber, Long.MAX_VALUE); + TestSubscriber ts = new TestSubscriber<>(subscriber, Long.MAX_VALUE); flowable.subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); @@ -228,7 +228,7 @@ public void run() { @Test public void backpressure() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(0, 100000) .onErrorResumeNext(new Function>() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorReturnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorReturnTest.java index 324cfe0eec..ecde026f95 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorReturnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorReturnTest.java @@ -39,7 +39,7 @@ public class FlowableOnErrorReturnTest extends RxJavaTest { public void resumeNext() { TestFlowable f = new TestFlowable("one"); Flowable w = Flowable.unsafeCreate(f); - final AtomicReference capturedException = new AtomicReference(); + final AtomicReference capturedException = new AtomicReference<>(); Flowable flowable = w.onErrorReturn(new Function() { @@ -74,7 +74,7 @@ public String apply(Throwable e) { public void functionThrowsError() { TestFlowable f = new TestFlowable("one"); Flowable w = Flowable.unsafeCreate(f); - final AtomicReference capturedException = new AtomicReference(); + final AtomicReference capturedException = new AtomicReference<>(); Flowable flowable = w.onErrorReturn(new Function() { @@ -132,7 +132,7 @@ public String apply(Throwable t1) { }); Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber, Long.MAX_VALUE); + TestSubscriber ts = new TestSubscriber<>(subscriber, Long.MAX_VALUE); flowable.subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); @@ -146,7 +146,7 @@ public String apply(Throwable t1) { @Test public void backpressure() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(0, 100000) .onErrorReturn(new Function() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishFunctionTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishFunctionTest.java index f62616097e..a660eb7429 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishFunctionTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishFunctionTest.java @@ -37,7 +37,7 @@ public class FlowablePublishFunctionTest extends RxJavaTest { @Test public void concatTakeFirstLastCompletes() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 3).publish(new Function, Flowable>() { @Override @@ -210,7 +210,7 @@ public Flowable apply(Flowable f) { @Test public void overflowMissingBackpressureException() { - TestSubscriberEx ts = new TestSubscriberEx(0); + TestSubscriberEx ts = new TestSubscriberEx<>(0); PublishProcessor pp = PublishProcessor.create(); @@ -236,11 +236,11 @@ public Flowable apply(Flowable f) { @Test public void overflowMissingBackpressureExceptionDelayed() { - TestSubscriberEx ts = new TestSubscriberEx(0); + TestSubscriberEx ts = new TestSubscriberEx<>(0); PublishProcessor pp = PublishProcessor.create(); - new FlowablePublishMulticast(pp, new Function, Flowable>() { + new FlowablePublishMulticast<>(pp, new Function, Flowable>() { @Override public Flowable apply(Flowable f) { return f; @@ -349,7 +349,7 @@ public Integer apply(Integer v) throws Exception { @Test public void error() { - new FlowablePublishMulticast(Flowable.just(1).concatWith(Flowable.error(new TestException())), + new FlowablePublishMulticast<>(Flowable.just(1).concatWith(Flowable.error(new TestException())), Functions.>identity(), 16, true) .test() .assertFailure(TestException.class, 1); @@ -428,7 +428,7 @@ public void inputOutputSubscribeRace2() { @Test public void sourceSubscriptionDelayed() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { - final TestSubscriber ts1 = new TestSubscriber(0L); + final TestSubscriber ts1 = new TestSubscriber<>(0L); Flowable.just(1) .publish(new Function, Publisher>() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishMulticastTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishMulticastTest.java index 186285e1f2..0fb61a84c5 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishMulticastTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishMulticastTest.java @@ -32,7 +32,7 @@ public class FlowablePublishMulticastTest extends RxJavaTest { @Test public void asyncFusedInput() { - MulticastProcessor mp = new MulticastProcessor(128, true); + MulticastProcessor mp = new MulticastProcessor<>(128, true); UnicastProcessor up = UnicastProcessor.create(); @@ -51,7 +51,7 @@ public void asyncFusedInput() { @Test public void fusionRejectedInput() { - MulticastProcessor mp = new MulticastProcessor(128, true); + MulticastProcessor mp = new MulticastProcessor<>(128, true); mp.onSubscribe(new QueueSubscription() { @@ -106,10 +106,10 @@ public void cancel() { public void addRemoveRace() { for (int i = 0; i < TestHelper.RACE_LONG_LOOPS; i++) { - final MulticastProcessor mp = new MulticastProcessor(128, true); + final MulticastProcessor mp = new MulticastProcessor<>(128, true); - final MulticastSubscription ms1 = new MulticastSubscription(null, mp); - final MulticastSubscription ms2 = new MulticastSubscription(null, mp); + final MulticastSubscription ms1 = new MulticastSubscription<>(null, mp); + final MulticastSubscription ms2 = new MulticastSubscription<>(null, mp); assertTrue(mp.add(ms1)); @@ -133,9 +133,9 @@ public void run() { @Test public void removeNotFound() { - MulticastProcessor mp = new MulticastProcessor(128, true); + MulticastProcessor mp = new MulticastProcessor<>(128, true); - MulticastSubscription ms1 = new MulticastSubscription(null, mp); + MulticastSubscription ms1 = new MulticastSubscription<>(null, mp); assertTrue(mp.add(ms1)); mp.remove(null); @@ -143,9 +143,9 @@ public void removeNotFound() { @Test public void errorAllCancelled() { - MulticastProcessor mp = new MulticastProcessor(128, true); + MulticastProcessor mp = new MulticastProcessor<>(128, true); - MulticastSubscription ms1 = new MulticastSubscription(null, mp); + MulticastSubscription ms1 = new MulticastSubscription<>(null, mp); assertTrue(mp.add(ms1)); ms1.set(Long.MIN_VALUE); @@ -155,9 +155,9 @@ public void errorAllCancelled() { @Test public void completeAllCancelled() { - MulticastProcessor mp = new MulticastProcessor(128, true); + MulticastProcessor mp = new MulticastProcessor<>(128, true); - MulticastSubscription ms1 = new MulticastSubscription(null, mp); + MulticastSubscription ms1 = new MulticastSubscription<>(null, mp); assertTrue(mp.add(ms1)); ms1.set(Long.MIN_VALUE); @@ -167,9 +167,9 @@ public void completeAllCancelled() { @Test public void cancelledWhileFindingRequests() { - final MulticastProcessor mp = new MulticastProcessor(128, true); + final MulticastProcessor mp = new MulticastProcessor<>(128, true); - final MulticastSubscription ms1 = new MulticastSubscription(null, mp); + final MulticastSubscription ms1 = new MulticastSubscription<>(null, mp); assertTrue(mp.add(ms1)); @@ -182,9 +182,9 @@ public void cancelledWhileFindingRequests() { @Test public void negativeRequest() { - final MulticastProcessor mp = new MulticastProcessor(128, true); + final MulticastProcessor mp = new MulticastProcessor<>(128, true); - final MulticastSubscription ms1 = new MulticastSubscription(null, mp); + final MulticastSubscription ms1 = new MulticastSubscription<>(null, mp); List errors = TestHelper.trackPluginErrors(); try { @@ -198,19 +198,19 @@ public void negativeRequest() { @Test public void outputCancellerDoubleOnSubscribe() { - TestHelper.doubleOnSubscribe(new OutputCanceller(new TestSubscriber(), null)); + TestHelper.doubleOnSubscribe(new OutputCanceller<>(new TestSubscriber<>(), null)); } @Test public void dontDropItemsWhenNoReadyConsumers() { - final MulticastProcessor mp = new MulticastProcessor(128, true); + final MulticastProcessor mp = new MulticastProcessor<>(128, true); mp.onSubscribe(new BooleanSubscription()); mp.onNext(1); - TestSubscriber ts = new TestSubscriber(); - final MulticastSubscription ms1 = new MulticastSubscription(ts, mp); + TestSubscriber ts = new TestSubscriber<>(); + final MulticastSubscription ms1 = new MulticastSubscription<>(ts, mp); ts.onSubscribe(ms1); assertTrue(mp.add(ms1)); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishTest.java index 0ecba3926f..ec7c88da09 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowablePublishTest.java @@ -128,7 +128,7 @@ public void run() { }); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.merge(fast, slow).subscribe(ts); is.connect(); ts.awaitDone(5, TimeUnit.SECONDS); @@ -148,7 +148,7 @@ public void accept(Integer t1) { } }); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); xs.publish(new Function, Flowable>() { @Override @@ -175,7 +175,7 @@ public boolean test(Integer i) { @Test public void takeUntilWithPublishedStream() { Flowable xs = Flowable.range(0, Flowable.bufferSize() * 2); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); ConnectableFlowable xsp = xs.publish(); xsp.takeUntil(xsp.skipWhile(new Predicate() { @@ -211,7 +211,7 @@ public void run() { final AtomicBoolean child1Unsubscribed = new AtomicBoolean(); final AtomicBoolean child2Unsubscribed = new AtomicBoolean(); - final TestSubscriber ts2 = new TestSubscriber(); + final TestSubscriber ts2 = new TestSubscriber<>(); final TestSubscriber ts1 = new TestSubscriber() { @Override @@ -259,7 +259,7 @@ public void connectWithNoSubscriber() { cf.connect(); // Emit 0 scheduler.advanceTimeBy(15, TimeUnit.MILLISECONDS); - TestSubscriber subscriber = new TestSubscriber(); + TestSubscriber subscriber = new TestSubscriber<>(); cf.subscribe(subscriber); // Emit 1 and 2 scheduler.advanceTimeBy(50, TimeUnit.MILLISECONDS); @@ -271,7 +271,7 @@ public void connectWithNoSubscriber() { public void subscribeAfterDisconnectThenConnect() { ConnectableFlowable source = Flowable.just(1).publish(); - TestSubscriberEx ts1 = new TestSubscriberEx(); + TestSubscriberEx ts1 = new TestSubscriberEx<>(); source.subscribe(ts1); @@ -283,7 +283,7 @@ public void subscribeAfterDisconnectThenConnect() { source.reset(); - TestSubscriberEx ts2 = new TestSubscriberEx(); + TestSubscriberEx ts2 = new TestSubscriberEx<>(); source.subscribe(ts2); @@ -301,7 +301,7 @@ public void subscribeAfterDisconnectThenConnect() { public void noSubscriberRetentionOnCompleted() { FlowablePublish source = (FlowablePublish)Flowable.just(1).publish(); - TestSubscriberEx ts1 = new TestSubscriberEx(); + TestSubscriberEx ts1 = new TestSubscriberEx<>(); source.subscribe(ts1); @@ -353,7 +353,7 @@ static boolean checkPublishDisposed(Disposable d) { public void zeroRequested() { ConnectableFlowable source = Flowable.just(1).publish(); - TestSubscriberEx ts = new TestSubscriberEx(0L); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); source.subscribe(ts); @@ -408,9 +408,9 @@ public void syncFusedObserveOn() { Flowable obs = cf.observeOn(Schedulers.computation()); for (int i = 0; i < 1000; i++) { for (int j = 1; j < 6; j++) { - List> tss = new ArrayList>(); + List> tss = new ArrayList<>(); for (int k = 1; k < j; k++) { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); tss.add(ts); obs.subscribe(ts); } @@ -435,9 +435,9 @@ public void syncFusedObserveOn2() { Flowable obs = cf.observeOn(ImmediateThinScheduler.INSTANCE); for (int i = 0; i < 1000; i++) { for (int j = 1; j < 6; j++) { - List> tss = new ArrayList>(); + List> tss = new ArrayList<>(); for (int k = 1; k < j; k++) { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); tss.add(ts); obs.subscribe(ts); } @@ -461,9 +461,9 @@ public void asyncFusedObserveOn() { ConnectableFlowable cf = Flowable.range(0, 1000).observeOn(ImmediateThinScheduler.INSTANCE).publish(); for (int i = 0; i < 1000; i++) { for (int j = 1; j < 6; j++) { - List> tss = new ArrayList>(); + List> tss = new ArrayList<>(); for (int k = 1; k < j; k++) { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); tss.add(ts); cf.subscribe(ts); } @@ -488,9 +488,9 @@ public void observeOn() { Flowable obs = cf.observeOn(Schedulers.computation()); for (int i = 0; i < 1000; i++) { for (int j = 1; j < 6; j++) { - List> tss = new ArrayList>(); + List> tss = new ArrayList<>(); for (int k = 1; k < j; k++) { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); tss.add(ts); obs.subscribe(ts); } @@ -539,7 +539,7 @@ public void addRemoveRace() { final TestSubscriber ts = cf.test(); - final TestSubscriber ts2 = new TestSubscriber(); + final TestSubscriber ts2 = new TestSubscriber<>(); Runnable r1 = new Runnable() { @Override @@ -694,7 +694,7 @@ public void subscribeDisconnectRace() { final ConnectableFlowable cf = pp.publish(); final Disposable d = cf.connect(); - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Runnable r1 = new Runnable() { @Override @@ -938,7 +938,7 @@ protected void subscribeActual(Subscriber s) { public void disposeRace() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { - final AtomicReference ref = new AtomicReference(); + final AtomicReference ref = new AtomicReference<>(); final ConnectableFlowable cf = new Flowable() { @Override @@ -963,7 +963,7 @@ public void run() { @Test public void removeNotPresent() { - final AtomicReference> ref = new AtomicReference>(); + final AtomicReference> ref = new AtomicReference<>(); final ConnectableFlowable cf = new Flowable() { @Override @@ -976,7 +976,7 @@ protected void subscribeActual(Subscriber s) { cf.connect(); - ref.get().add(new InnerSubscription(new TestSubscriber(), ref.get())); + ref.get().add(new InnerSubscription<>(new TestSubscriber<>(), ref.get())); ref.get().remove(null); } @@ -999,7 +999,7 @@ public void onNext(Integer t) { ts1.assertResult(1); - TestSubscriber ts2 = new TestSubscriber(0); + TestSubscriber ts2 = new TestSubscriber<>(0); cf.subscribe(ts2); ts2 @@ -1012,7 +1012,7 @@ public void onNext(Integer t) { public void subscriberLiveSwap() { final ConnectableFlowable cf = Flowable.range(1, 5).publish(); - final TestSubscriber ts2 = new TestSubscriber(0); + final TestSubscriber ts2 = new TestSubscriber<>(0); TestSubscriber ts1 = new TestSubscriber() { @Override @@ -1038,7 +1038,7 @@ public void onNext(Integer t) { @Test public void selectorSubscriberSwap() { - final AtomicReference> ref = new AtomicReference>(); + final AtomicReference> ref = new AtomicReference<>(); Flowable.range(1, 5).publish(new Function, Publisher>() { @Override @@ -1061,7 +1061,7 @@ public Publisher apply(Flowable f) throws Exception { @Test public void leavingSubscriberOverrequests() { - final AtomicReference> ref = new AtomicReference>(); + final AtomicReference> ref = new AtomicReference<>(); PublishProcessor pp = PublishProcessor.create(); @@ -1205,7 +1205,7 @@ public Publisher apply(Integer first) @Test public void publishFunctionCancelOuterAfterOneInner() { - final AtomicReference> ref = new AtomicReference>(); + final AtomicReference> ref = new AtomicReference<>(); PublishProcessor pp = PublishProcessor.create(); @@ -1231,7 +1231,7 @@ public void onNext(Integer t) { @Test public void publishFunctionCancelOuterAfterOneInnerBackpressured() { - final AtomicReference> ref = new AtomicReference>(); + final AtomicReference> ref = new AtomicReference<>(); PublishProcessor pp = PublishProcessor.create(); @@ -1261,7 +1261,7 @@ public void publishCancelOneAsync() { final PublishProcessor pp = PublishProcessor.create(); - final AtomicReference> ref = new AtomicReference>(); + final AtomicReference> ref = new AtomicReference<>(); pp.publish(new Function, Publisher>() { @Override @@ -1300,9 +1300,9 @@ public void publishCancelOneAsync2() { ConnectableFlowable cf = pp.publish(); - final TestSubscriber ts1 = new TestSubscriber(); + final TestSubscriber ts1 = new TestSubscriber<>(); - final AtomicReference> ref = new AtomicReference>(); + final AtomicReference> ref = new AtomicReference<>(); cf.subscribe(new FlowableSubscriber() { @SuppressWarnings("unchecked") @@ -1500,7 +1500,7 @@ public boolean test(List v) throws Exception { @Test public void altConnectCrash() { try { - new FlowablePublish(Flowable.empty(), 128) + new FlowablePublish<>(Flowable.empty(), 128) .connect(new Consumer() { @Override public void accept(Disposable t) throws Exception { @@ -1517,7 +1517,7 @@ public void accept(Disposable t) throws Exception { public void altConnectRace() { for (int i = 0; i < TestHelper.RACE_LONG_LOOPS; i++) { final ConnectableFlowable cf = - new FlowablePublish(Flowable.never(), 128); + new FlowablePublish<>(Flowable.never(), 128); Runnable r = new Runnable() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeLongTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeLongTest.java index afc677aefe..96401918ef 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeLongTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeLongTest.java @@ -98,7 +98,7 @@ public void rangeWithOverflow5() { public void backpressureViaRequest() { Flowable f = Flowable.rangeLong(1, Flowable.bufferSize()); - TestSubscriberEx ts = new TestSubscriberEx(0L); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); ts.assertNoValues(); ts.request(1); @@ -119,14 +119,14 @@ public void backpressureViaRequest() { @Test public void noBackpressure() { - ArrayList list = new ArrayList(Flowable.bufferSize() * 2); + ArrayList list = new ArrayList<>(Flowable.bufferSize() * 2); for (long i = 1; i <= Flowable.bufferSize() * 2 + 1; i++) { list.add(i); } Flowable f = Flowable.rangeLong(1, list.size()); - TestSubscriberEx ts = new TestSubscriberEx(0L); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); ts.assertNoValues(); ts.request(Long.MAX_VALUE); // infinite @@ -139,11 +139,11 @@ public void noBackpressure() { void withBackpressureOneByOne(long start) { Flowable source = Flowable.rangeLong(start, 100); - TestSubscriberEx ts = new TestSubscriberEx(0L); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); ts.request(1); source.subscribe(ts); - List list = new ArrayList(100); + List list = new ArrayList<>(100); for (long i = 0; i < 100; i++) { list.add(i + start); ts.request(1); @@ -154,11 +154,11 @@ void withBackpressureOneByOne(long start) { void withBackpressureAllAtOnce(long start) { Flowable source = Flowable.rangeLong(start, 100); - TestSubscriberEx ts = new TestSubscriberEx(0L); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); ts.request(100); source.subscribe(ts); - List list = new ArrayList(100); + List list = new ArrayList<>(100); for (long i = 0; i < 100; i++) { list.add(i + start); } @@ -184,11 +184,11 @@ public void withBackpressureAllAtOnce() { public void withBackpressureRequestWayMore() { Flowable source = Flowable.rangeLong(50, 100); - TestSubscriberEx ts = new TestSubscriberEx(0L); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); ts.request(150); source.subscribe(ts); - List list = new ArrayList(100); + List list = new ArrayList<>(100); for (long i = 0; i < 100; i++) { list.add(i + 50); } @@ -257,7 +257,7 @@ public void onNext(Long t) { @Test public void nearMaxValueWithoutBackpressure() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.rangeLong(Long.MAX_VALUE - 1L, 2L).subscribe(ts); ts.assertComplete(); @@ -267,7 +267,7 @@ public void nearMaxValueWithoutBackpressure() { @Test public void nearMaxValueWithBackpressure() { - TestSubscriber ts = new TestSubscriber(3L); + TestSubscriber ts = new TestSubscriber<>(3L); Flowable.rangeLong(Long.MAX_VALUE - 1L, 2L).subscribe(ts); ts.assertComplete(); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeTest.java index a8d42213c9..39ab84ad63 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeTest.java @@ -98,7 +98,7 @@ public void rangeWithOverflow5() { public void backpressureViaRequest() { Flowable f = Flowable.range(1, Flowable.bufferSize()); - TestSubscriberEx ts = new TestSubscriberEx(0L); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); ts.assertNoValues(); ts.request(1); @@ -119,14 +119,14 @@ public void backpressureViaRequest() { @Test public void noBackpressure() { - ArrayList list = new ArrayList(Flowable.bufferSize() * 2); + ArrayList list = new ArrayList<>(Flowable.bufferSize() * 2); for (int i = 1; i <= Flowable.bufferSize() * 2 + 1; i++) { list.add(i); } Flowable f = Flowable.range(1, list.size()); - TestSubscriberEx ts = new TestSubscriberEx(0L); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); ts.assertNoValues(); ts.request(Long.MAX_VALUE); // infinite @@ -139,11 +139,11 @@ public void noBackpressure() { void withBackpressureOneByOne(int start) { Flowable source = Flowable.range(start, 100); - TestSubscriberEx ts = new TestSubscriberEx(0L); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); ts.request(1); source.subscribe(ts); - List list = new ArrayList(100); + List list = new ArrayList<>(100); for (int i = 0; i < 100; i++) { list.add(i + start); ts.request(1); @@ -154,11 +154,11 @@ void withBackpressureOneByOne(int start) { void withBackpressureAllAtOnce(int start) { Flowable source = Flowable.range(start, 100); - TestSubscriberEx ts = new TestSubscriberEx(0L); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); ts.request(100); source.subscribe(ts); - List list = new ArrayList(100); + List list = new ArrayList<>(100); for (int i = 0; i < 100; i++) { list.add(i + start); } @@ -184,11 +184,11 @@ public void withBackpressureAllAtOnce() { public void withBackpressureRequestWayMore() { Flowable source = Flowable.range(50, 100); - TestSubscriberEx ts = new TestSubscriberEx(0L); + TestSubscriberEx ts = new TestSubscriberEx<>(0L); ts.request(150); source.subscribe(ts); - List list = new ArrayList(100); + List list = new ArrayList<>(100); for (int i = 0; i < 100; i++) { list.add(i + 50); } @@ -257,7 +257,7 @@ public void onNext(Integer t) { @Test public void nearMaxValueWithoutBackpressure() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(Integer.MAX_VALUE - 1, 2).subscribe(ts); ts.assertComplete(); @@ -267,7 +267,7 @@ public void nearMaxValueWithoutBackpressure() { @Test public void nearMaxValueWithBackpressure() { - TestSubscriber ts = new TestSubscriber(3L); + TestSubscriber ts = new TestSubscriber<>(3L); Flowable.range(Integer.MAX_VALUE - 1, 2).subscribe(ts); ts.assertComplete(); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRefCountTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRefCountTest.java index 975740cfe3..169409ed1b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRefCountTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRefCountTest.java @@ -205,8 +205,8 @@ public void run() { .publish().refCount(); for (int i = 0; i < 10; i++) { - TestSubscriber ts1 = new TestSubscriber(); - TestSubscriber ts2 = new TestSubscriber(); + TestSubscriber ts1 = new TestSubscriber<>(); + TestSubscriber ts2 = new TestSubscriber<>(); r.subscribe(ts1); r.subscribe(ts2); try { @@ -248,7 +248,7 @@ public void run() { } }); - TestSubscriberEx s = new TestSubscriberEx(); + TestSubscriberEx s = new TestSubscriberEx<>(); f.publish().refCount().subscribeOn(Schedulers.newThread()).subscribe(s); System.out.println("send unsubscribe"); // wait until connected @@ -293,7 +293,7 @@ public void accept(Subscription s) { } }); - TestSubscriberEx s = new TestSubscriberEx(); + TestSubscriberEx s = new TestSubscriberEx<>(); f.publish().refCount().subscribeOn(Schedulers.computation()).subscribe(s); System.out.println("send unsubscribe"); @@ -386,7 +386,7 @@ public void refCount() { Flowable interval = Flowable.interval(100, TimeUnit.MILLISECONDS, s).publish().refCount(); // subscribe list1 - final List list1 = new ArrayList(); + final List list1 = new ArrayList<>(); Disposable d1 = interval.subscribe(new Consumer() { @Override public void accept(Long t1) { @@ -401,7 +401,7 @@ public void accept(Long t1) { assertEquals(1L, list1.get(1).longValue()); // subscribe list2 - final List list2 = new ArrayList(); + final List list2 = new ArrayList<>(); Disposable d2 = interval.subscribe(new Consumer() { @Override public void accept(Long t1) { @@ -446,7 +446,7 @@ public void accept(Long t1) { // subscribing a new one should start over because the source should have been unsubscribed // subscribe list3 - final List list3 = new ArrayList(); + final List list3 = new ArrayList<>(); interval.subscribe(new Consumer() { @Override public void accept(Long t1) { @@ -517,8 +517,8 @@ public Integer apply(Integer t1, Integer t2) { }) .publish().refCount(); - TestSubscriberEx ts1 = new TestSubscriberEx(); - TestSubscriberEx ts2 = new TestSubscriberEx(); + TestSubscriberEx ts1 = new TestSubscriberEx<>(); + TestSubscriberEx ts2 = new TestSubscriberEx<>(); combined.subscribe(ts1); combined.subscribe(ts2); @@ -1184,7 +1184,7 @@ public void unsubscribeSubscribeRace() { final TestSubscriber ts1 = source.test(0); - final TestSubscriber ts2 = new TestSubscriber(0); + final TestSubscriber ts2 = new TestSubscriber<>(0); Runnable r1 = new Runnable() { @Override @@ -1388,7 +1388,7 @@ protected void subscribeActual(Subscriber subscriber) { @Test public void timeoutResetsSource() { - TestConnectableFlowable tcf = new TestConnectableFlowable(); + TestConnectableFlowable tcf = new TestConnectableFlowable<>(); FlowableRefCount o = (FlowableRefCount)tcf.refCount(); RefConnection rc = new RefConnection(o); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatTest.java index c99e09a45a..29959688ad 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatTest.java @@ -164,7 +164,7 @@ public void repeatAndDistinctUnbounded() { .repeat(3) .distinct(); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); src.subscribe(ts); @@ -176,8 +176,8 @@ public void repeatAndDistinctUnbounded() { /** Issue #2844: wrong target of request. */ @Test public void repeatRetarget() { - final List concatBase = new ArrayList(); - TestSubscriber ts = new TestSubscriber(); + final List concatBase = new ArrayList<>(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.just(1, 2) .repeat(5) .concatMap(new Function>() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplayEagerTruncateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplayEagerTruncateTest.java index d17526e47b..f263b98f66 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplayEagerTruncateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplayEagerTruncateTest.java @@ -732,14 +732,14 @@ public boolean isDisposed() { @Test public void boundedReplayBuffer() { - BoundedReplayBuffer buf = new BoundedReplayBuffer(true); + BoundedReplayBuffer buf = new BoundedReplayBuffer<>(true); buf.addLast(new Node(1, 0)); buf.addLast(new Node(2, 1)); buf.addLast(new Node(3, 2)); buf.addLast(new Node(4, 3)); buf.addLast(new Node(5, 4)); - List values = new ArrayList(); + List values = new ArrayList<>(); buf.collect(values); Assert.assertEquals(Arrays.asList(1, 2, 3, 4, 5), values); @@ -762,8 +762,8 @@ public void boundedReplayBuffer() { @Test public void timedAndSizedTruncation() { TestScheduler test = new TestScheduler(); - SizeAndTimeBoundReplayBuffer buf = new SizeAndTimeBoundReplayBuffer(2, 2000, TimeUnit.MILLISECONDS, test, true); - List values = new ArrayList(); + SizeAndTimeBoundReplayBuffer buf = new SizeAndTimeBoundReplayBuffer<>(2, 2000, TimeUnit.MILLISECONDS, test, true); + List values = new ArrayList<>(); buf.next(1); test.advanceTimeBy(1, TimeUnit.SECONDS); @@ -808,8 +808,8 @@ public void accept(long t) { }); ConnectableFlowable cf = source.replay(); - TestSubscriberEx ts1 = new TestSubscriberEx(10L); - TestSubscriberEx ts2 = new TestSubscriberEx(90L); + TestSubscriberEx ts1 = new TestSubscriberEx<>(10L); + TestSubscriberEx ts2 = new TestSubscriberEx<>(90L); cf.subscribe(ts1); cf.subscribe(ts2); @@ -839,8 +839,8 @@ public void accept(long t) { }); ConnectableFlowable cf = source.replay(50, true); - TestSubscriberEx ts1 = new TestSubscriberEx(10L); - TestSubscriberEx ts2 = new TestSubscriberEx(90L); + TestSubscriberEx ts1 = new TestSubscriberEx<>(10L); + TestSubscriberEx ts2 = new TestSubscriberEx<>(90L); cf.subscribe(ts1); cf.subscribe(ts2); @@ -862,7 +862,7 @@ public void accept(long t) { public void coldReplayNoBackpressure() { Flowable source = Flowable.range(0, 1000).replay().autoConnect(); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); source.subscribe(ts); @@ -880,7 +880,7 @@ public void coldReplayNoBackpressure() { public void coldReplayBackpressure() { Flowable source = Flowable.range(0, 1000).replay().autoConnect(); - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); ts.request(10); source.subscribe(ts); @@ -961,7 +961,7 @@ public void unsubscribeSource() throws Throwable { @Test public void take() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); Flowable cached = Flowable.range(1, 100).replay().autoConnect(); cached.take(10).subscribe(ts); @@ -975,7 +975,7 @@ public void take() { public void async() { Flowable source = Flowable.range(1, 10000); for (int i = 0; i < 100; i++) { - TestSubscriberEx ts1 = new TestSubscriberEx(); + TestSubscriberEx ts1 = new TestSubscriberEx<>(); Flowable cached = source.replay().autoConnect(); @@ -986,7 +986,7 @@ public void async() { ts1.assertTerminated(); assertEquals(10000, ts1.values().size()); - TestSubscriberEx ts2 = new TestSubscriberEx(); + TestSubscriberEx ts2 = new TestSubscriberEx<>(); cached.observeOn(Schedulers.computation()).subscribe(ts2); ts2.awaitDone(2, TimeUnit.SECONDS); @@ -1005,14 +1005,14 @@ public void asyncComeAndGo() { Flowable output = cached.observeOn(Schedulers.computation(), false, 1024); - List> list = new ArrayList>(100); + List> list = new ArrayList<>(100); for (int i = 0; i < 100; i++) { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); list.add(ts); output.skip(i * 10).take(10).subscribe(ts); } - List expected = new ArrayList(); + List expected = new ArrayList<>(); for (int i = 0; i < 10; i++) { expected.add((long)(i - 10)); } @@ -1046,7 +1046,7 @@ public void subscribe(Subscriber t) { } }); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); firehose.replay().autoConnect().observeOn(Schedulers.computation()).takeLast(100).subscribe(ts); ts.awaitDone(3, TimeUnit.SECONDS); @@ -1062,14 +1062,14 @@ public void valuesAndThenError() { .concatWith(Flowable.error(new TestException())) .replay().autoConnect(); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); source.subscribe(ts); ts.assertValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); ts.assertNotComplete(); Assert.assertEquals(1, ts.errors().size()); - TestSubscriberEx ts2 = new TestSubscriberEx(); + TestSubscriberEx ts2 = new TestSubscriberEx<>(); source.subscribe(ts2); ts2.assertValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); @@ -1110,7 +1110,7 @@ public void onNext(Integer t) { public void unboundedLeavesEarly() { PublishProcessor source = PublishProcessor.create(); - final List requests = new ArrayList(); + final List requests = new ArrayList<>(); Flowable out = source .doOnRequest(new LongConsumer() { @@ -1120,8 +1120,8 @@ public void accept(long t) { } }).replay().autoConnect(); - TestSubscriber ts1 = new TestSubscriber(5L); - TestSubscriber ts2 = new TestSubscriber(10L); + TestSubscriber ts1 = new TestSubscriber<>(5L); + TestSubscriber ts2 = new TestSubscriber<>(10L); out.subscribe(ts1); out.subscribe(ts2); @@ -1135,7 +1135,7 @@ public void subscribersComeAndGoAtRequestBoundaries() { ConnectableFlowable source = Flowable.range(1, 10).replay(1, true); source.connect(); - TestSubscriber ts1 = new TestSubscriber(2L); + TestSubscriber ts1 = new TestSubscriber<>(2L); source.subscribe(ts1); @@ -1143,7 +1143,7 @@ public void subscribersComeAndGoAtRequestBoundaries() { ts1.assertNoErrors(); ts1.cancel(); - TestSubscriber ts2 = new TestSubscriber(2L); + TestSubscriber ts2 = new TestSubscriber<>(2L); source.subscribe(ts2); @@ -1151,7 +1151,7 @@ public void subscribersComeAndGoAtRequestBoundaries() { ts2.assertNoErrors(); ts2.cancel(); - TestSubscriber ts21 = new TestSubscriber(1L); + TestSubscriber ts21 = new TestSubscriber<>(1L); source.subscribe(ts21); @@ -1159,7 +1159,7 @@ public void subscribersComeAndGoAtRequestBoundaries() { ts21.assertNoErrors(); ts21.cancel(); - TestSubscriber ts22 = new TestSubscriber(1L); + TestSubscriber ts22 = new TestSubscriber<>(1L); source.subscribe(ts22); @@ -1167,7 +1167,7 @@ public void subscribersComeAndGoAtRequestBoundaries() { ts22.assertNoErrors(); ts22.cancel(); - TestSubscriber ts3 = new TestSubscriber(); + TestSubscriber ts3 = new TestSubscriber<>(); source.subscribe(ts3); @@ -1182,7 +1182,7 @@ public void subscribersComeAndGoAtRequestBoundaries2() { ConnectableFlowable source = Flowable.range(1, 10).replay(2, true); source.connect(); - TestSubscriber ts1 = new TestSubscriber(2L); + TestSubscriber ts1 = new TestSubscriber<>(2L); source.subscribe(ts1); @@ -1190,7 +1190,7 @@ public void subscribersComeAndGoAtRequestBoundaries2() { ts1.assertNoErrors(); ts1.cancel(); - TestSubscriber ts11 = new TestSubscriber(2L); + TestSubscriber ts11 = new TestSubscriber<>(2L); source.subscribe(ts11); @@ -1198,7 +1198,7 @@ public void subscribersComeAndGoAtRequestBoundaries2() { ts11.assertNoErrors(); ts11.cancel(); - TestSubscriber ts2 = new TestSubscriber(3L); + TestSubscriber ts2 = new TestSubscriber<>(3L); source.subscribe(ts2); @@ -1206,7 +1206,7 @@ public void subscribersComeAndGoAtRequestBoundaries2() { ts2.assertNoErrors(); ts2.cancel(); - TestSubscriber ts21 = new TestSubscriber(1L); + TestSubscriber ts21 = new TestSubscriber<>(1L); source.subscribe(ts21); @@ -1214,7 +1214,7 @@ public void subscribersComeAndGoAtRequestBoundaries2() { ts21.assertNoErrors(); ts21.cancel(); - TestSubscriber ts22 = new TestSubscriber(1L); + TestSubscriber ts22 = new TestSubscriber<>(1L); source.subscribe(ts22); @@ -1222,7 +1222,7 @@ public void subscribersComeAndGoAtRequestBoundaries2() { ts22.assertNoErrors(); ts22.cancel(); - TestSubscriber ts3 = new TestSubscriber(); + TestSubscriber ts3 = new TestSubscriber<>(); source.subscribe(ts3); @@ -1286,8 +1286,8 @@ public void subscribeRace() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { final ConnectableFlowable cf = Flowable.range(1, 3).replay(); - final TestSubscriber ts1 = new TestSubscriber(); - final TestSubscriber ts2 = new TestSubscriber(); + final TestSubscriber ts1 = new TestSubscriber<>(); + final TestSubscriber ts2 = new TestSubscriber<>(); Runnable r1 = new Runnable() { @Override @@ -1312,8 +1312,8 @@ public void addRemoveRace() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { final ConnectableFlowable cf = Flowable.range(1, 3).replay(); - final TestSubscriber ts1 = new TestSubscriber(); - final TestSubscriber ts2 = new TestSubscriber(); + final TestSubscriber ts1 = new TestSubscriber<>(); + final TestSubscriber ts2 = new TestSubscriber<>(); cf.subscribe(ts1); @@ -1412,7 +1412,7 @@ public void subscribeOnNextRace() { final ConnectableFlowable cf = pp.replay(); - final TestSubscriber ts1 = new TestSubscriber(); + final TestSubscriber ts1 = new TestSubscriber<>(); Runnable r1 = new Runnable() { @Override @@ -1441,7 +1441,7 @@ public void unsubscribeOnNextRace() { final ConnectableFlowable cf = pp.replay(); - final TestSubscriber ts1 = new TestSubscriber(); + final TestSubscriber ts1 = new TestSubscriber<>(); cf.subscribe(ts1); @@ -1470,7 +1470,7 @@ public void unsubscribeReplayRace() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { final ConnectableFlowable cf = Flowable.range(1, 1000).replay(); - final TestSubscriber ts1 = new TestSubscriber(); + final TestSubscriber ts1 = new TestSubscriber<>(); cf.connect(); @@ -1592,12 +1592,12 @@ public void replayMaxInt() { @Test public void timedAndSizedTruncationError() { TestScheduler test = new TestScheduler(); - SizeAndTimeBoundReplayBuffer buf = new SizeAndTimeBoundReplayBuffer(2, 2000, TimeUnit.MILLISECONDS, test, true); + SizeAndTimeBoundReplayBuffer buf = new SizeAndTimeBoundReplayBuffer<>(2, 2000, TimeUnit.MILLISECONDS, test, true); Assert.assertFalse(buf.hasCompleted()); Assert.assertFalse(buf.hasError()); - List values = new ArrayList(); + List values = new ArrayList<>(); buf.next(1); test.advanceTimeBy(1, TimeUnit.SECONDS); @@ -1635,8 +1635,8 @@ public void timedAndSizedTruncationError() { @Test public void sizedTruncation() { - SizeBoundReplayBuffer buf = new SizeBoundReplayBuffer(2, true); - List values = new ArrayList(); + SizeBoundReplayBuffer buf = new SizeBoundReplayBuffer<>(2, true); + List values = new ArrayList<>(); buf.next(1); buf.next(2); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplayTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplayTest.java index b8a7ba3e9d..67763fce0b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplayTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableReplayTest.java @@ -732,14 +732,14 @@ public boolean isDisposed() { @Test public void boundedReplayBuffer() { - BoundedReplayBuffer buf = new BoundedReplayBuffer(false); + BoundedReplayBuffer buf = new BoundedReplayBuffer<>(false); buf.addLast(new Node(1, 0)); buf.addLast(new Node(2, 1)); buf.addLast(new Node(3, 2)); buf.addLast(new Node(4, 3)); buf.addLast(new Node(5, 4)); - List values = new ArrayList(); + List values = new ArrayList<>(); buf.collect(values); Assert.assertEquals(Arrays.asList(1, 2, 3, 4, 5), values); @@ -763,8 +763,8 @@ public void boundedReplayBuffer() { @Test public void timedAndSizedTruncation() { TestScheduler test = new TestScheduler(); - SizeAndTimeBoundReplayBuffer buf = new SizeAndTimeBoundReplayBuffer(2, 2000, TimeUnit.MILLISECONDS, test, false); - List values = new ArrayList(); + SizeAndTimeBoundReplayBuffer buf = new SizeAndTimeBoundReplayBuffer<>(2, 2000, TimeUnit.MILLISECONDS, test, false); + List values = new ArrayList<>(); buf.next(1); test.advanceTimeBy(1, TimeUnit.SECONDS); @@ -809,8 +809,8 @@ public void accept(long t) { }); ConnectableFlowable cf = source.replay(); - TestSubscriberEx ts1 = new TestSubscriberEx(10L); - TestSubscriberEx ts2 = new TestSubscriberEx(90L); + TestSubscriberEx ts1 = new TestSubscriberEx<>(10L); + TestSubscriberEx ts2 = new TestSubscriberEx<>(90L); cf.subscribe(ts1); cf.subscribe(ts2); @@ -840,8 +840,8 @@ public void accept(long t) { }); ConnectableFlowable cf = source.replay(50); - TestSubscriberEx ts1 = new TestSubscriberEx(10L); - TestSubscriberEx ts2 = new TestSubscriberEx(90L); + TestSubscriberEx ts1 = new TestSubscriberEx<>(10L); + TestSubscriberEx ts2 = new TestSubscriberEx<>(90L); cf.subscribe(ts1); cf.subscribe(ts2); @@ -863,7 +863,7 @@ public void accept(long t) { public void coldReplayNoBackpressure() { Flowable source = Flowable.range(0, 1000).replay().autoConnect(); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); source.subscribe(ts); @@ -881,7 +881,7 @@ public void coldReplayNoBackpressure() { public void coldReplayBackpressure() { Flowable source = Flowable.range(0, 1000).replay().autoConnect(); - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); ts.request(10); source.subscribe(ts); @@ -962,7 +962,7 @@ public void unsubscribeSource() throws Throwable { @Test public void take() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); Flowable cached = Flowable.range(1, 100).replay().autoConnect(); cached.take(10).subscribe(ts); @@ -976,7 +976,7 @@ public void take() { public void async() { Flowable source = Flowable.range(1, 10000); for (int i = 0; i < 100; i++) { - TestSubscriberEx ts1 = new TestSubscriberEx(); + TestSubscriberEx ts1 = new TestSubscriberEx<>(); Flowable cached = source.replay().autoConnect(); @@ -987,7 +987,7 @@ public void async() { ts1.assertTerminated(); assertEquals(10000, ts1.values().size()); - TestSubscriberEx ts2 = new TestSubscriberEx(); + TestSubscriberEx ts2 = new TestSubscriberEx<>(); cached.observeOn(Schedulers.computation()).subscribe(ts2); ts2.awaitDone(2, TimeUnit.SECONDS); @@ -1006,14 +1006,14 @@ public void asyncComeAndGo() { Flowable output = cached.observeOn(Schedulers.computation(), false, 1024); - List> list = new ArrayList>(100); + List> list = new ArrayList<>(100); for (int i = 0; i < 100; i++) { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); list.add(ts); output.skip(i * 10).take(10).subscribe(ts); } - List expected = new ArrayList(); + List expected = new ArrayList<>(); for (int i = 0; i < 10; i++) { expected.add((long)(i - 10)); } @@ -1047,7 +1047,7 @@ public void subscribe(Subscriber t) { } }); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); firehose.replay().autoConnect().observeOn(Schedulers.computation()).takeLast(100).subscribe(ts); ts.awaitDone(3, TimeUnit.SECONDS); @@ -1063,14 +1063,14 @@ public void valuesAndThenError() { .concatWith(Flowable.error(new TestException())) .replay().autoConnect(); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); source.subscribe(ts); ts.assertValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); ts.assertNotComplete(); Assert.assertEquals(1, ts.errors().size()); - TestSubscriberEx ts2 = new TestSubscriberEx(); + TestSubscriberEx ts2 = new TestSubscriberEx<>(); source.subscribe(ts2); ts2.assertValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); @@ -1111,7 +1111,7 @@ public void onNext(Integer t) { public void unboundedLeavesEarly() { PublishProcessor source = PublishProcessor.create(); - final List requests = new ArrayList(); + final List requests = new ArrayList<>(); Flowable out = source .doOnRequest(new LongConsumer() { @@ -1121,8 +1121,8 @@ public void accept(long t) { } }).replay().autoConnect(); - TestSubscriber ts1 = new TestSubscriber(5L); - TestSubscriber ts2 = new TestSubscriber(10L); + TestSubscriber ts1 = new TestSubscriber<>(5L); + TestSubscriber ts2 = new TestSubscriber<>(10L); out.subscribe(ts1); out.subscribe(ts2); @@ -1136,7 +1136,7 @@ public void subscribersComeAndGoAtRequestBoundaries() { ConnectableFlowable source = Flowable.range(1, 10).replay(1); source.connect(); - TestSubscriber ts1 = new TestSubscriber(2L); + TestSubscriber ts1 = new TestSubscriber<>(2L); source.subscribe(ts1); @@ -1144,7 +1144,7 @@ public void subscribersComeAndGoAtRequestBoundaries() { ts1.assertNoErrors(); ts1.cancel(); - TestSubscriber ts2 = new TestSubscriber(2L); + TestSubscriber ts2 = new TestSubscriber<>(2L); source.subscribe(ts2); @@ -1152,7 +1152,7 @@ public void subscribersComeAndGoAtRequestBoundaries() { ts2.assertNoErrors(); ts2.cancel(); - TestSubscriber ts21 = new TestSubscriber(1L); + TestSubscriber ts21 = new TestSubscriber<>(1L); source.subscribe(ts21); @@ -1160,7 +1160,7 @@ public void subscribersComeAndGoAtRequestBoundaries() { ts21.assertNoErrors(); ts21.cancel(); - TestSubscriber ts22 = new TestSubscriber(1L); + TestSubscriber ts22 = new TestSubscriber<>(1L); source.subscribe(ts22); @@ -1168,7 +1168,7 @@ public void subscribersComeAndGoAtRequestBoundaries() { ts22.assertNoErrors(); ts22.cancel(); - TestSubscriber ts3 = new TestSubscriber(); + TestSubscriber ts3 = new TestSubscriber<>(); source.subscribe(ts3); @@ -1183,7 +1183,7 @@ public void subscribersComeAndGoAtRequestBoundaries2() { ConnectableFlowable source = Flowable.range(1, 10).replay(2); source.connect(); - TestSubscriber ts1 = new TestSubscriber(2L); + TestSubscriber ts1 = new TestSubscriber<>(2L); source.subscribe(ts1); @@ -1191,7 +1191,7 @@ public void subscribersComeAndGoAtRequestBoundaries2() { ts1.assertNoErrors(); ts1.cancel(); - TestSubscriber ts11 = new TestSubscriber(2L); + TestSubscriber ts11 = new TestSubscriber<>(2L); source.subscribe(ts11); @@ -1199,7 +1199,7 @@ public void subscribersComeAndGoAtRequestBoundaries2() { ts11.assertNoErrors(); ts11.cancel(); - TestSubscriber ts2 = new TestSubscriber(3L); + TestSubscriber ts2 = new TestSubscriber<>(3L); source.subscribe(ts2); @@ -1207,7 +1207,7 @@ public void subscribersComeAndGoAtRequestBoundaries2() { ts2.assertNoErrors(); ts2.cancel(); - TestSubscriber ts21 = new TestSubscriber(1L); + TestSubscriber ts21 = new TestSubscriber<>(1L); source.subscribe(ts21); @@ -1215,7 +1215,7 @@ public void subscribersComeAndGoAtRequestBoundaries2() { ts21.assertNoErrors(); ts21.cancel(); - TestSubscriber ts22 = new TestSubscriber(1L); + TestSubscriber ts22 = new TestSubscriber<>(1L); source.subscribe(ts22); @@ -1223,7 +1223,7 @@ public void subscribersComeAndGoAtRequestBoundaries2() { ts22.assertNoErrors(); ts22.cancel(); - TestSubscriber ts3 = new TestSubscriber(); + TestSubscriber ts3 = new TestSubscriber<>(); source.subscribe(ts3); @@ -1287,8 +1287,8 @@ public void subscribeRace() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { final ConnectableFlowable cf = Flowable.range(1, 3).replay(); - final TestSubscriber ts1 = new TestSubscriber(); - final TestSubscriber ts2 = new TestSubscriber(); + final TestSubscriber ts1 = new TestSubscriber<>(); + final TestSubscriber ts2 = new TestSubscriber<>(); Runnable r1 = new Runnable() { @Override @@ -1313,8 +1313,8 @@ public void addRemoveRace() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { final ConnectableFlowable cf = Flowable.range(1, 3).replay(); - final TestSubscriber ts1 = new TestSubscriber(); - final TestSubscriber ts2 = new TestSubscriber(); + final TestSubscriber ts1 = new TestSubscriber<>(); + final TestSubscriber ts2 = new TestSubscriber<>(); cf.subscribe(ts1); @@ -1413,7 +1413,7 @@ public void subscribeOnNextRace() { final ConnectableFlowable cf = pp.replay(); - final TestSubscriber ts1 = new TestSubscriber(); + final TestSubscriber ts1 = new TestSubscriber<>(); Runnable r1 = new Runnable() { @Override @@ -1442,7 +1442,7 @@ public void unsubscribeOnNextRace() { final ConnectableFlowable cf = pp.replay(); - final TestSubscriber ts1 = new TestSubscriber(); + final TestSubscriber ts1 = new TestSubscriber<>(); cf.subscribe(ts1); @@ -1471,7 +1471,7 @@ public void unsubscribeReplayRace() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { final ConnectableFlowable cf = Flowable.range(1, 1000).replay(); - final TestSubscriber ts1 = new TestSubscriber(); + final TestSubscriber ts1 = new TestSubscriber<>(); cf.connect(); @@ -1593,12 +1593,12 @@ public void replayMaxInt() { @Test public void timedAndSizedTruncationError() { TestScheduler test = new TestScheduler(); - SizeAndTimeBoundReplayBuffer buf = new SizeAndTimeBoundReplayBuffer(2, 2000, TimeUnit.MILLISECONDS, test, false); + SizeAndTimeBoundReplayBuffer buf = new SizeAndTimeBoundReplayBuffer<>(2, 2000, TimeUnit.MILLISECONDS, test, false); Assert.assertFalse(buf.hasCompleted()); Assert.assertFalse(buf.hasError()); - List values = new ArrayList(); + List values = new ArrayList<>(); buf.next(1); test.advanceTimeBy(1, TimeUnit.SECONDS); @@ -1636,8 +1636,8 @@ public void timedAndSizedTruncationError() { @Test public void sizedTruncation() { - SizeBoundReplayBuffer buf = new SizeBoundReplayBuffer(2, false); - List values = new ArrayList(); + SizeBoundReplayBuffer buf = new SizeBoundReplayBuffer<>(2, false); + List values = new ArrayList<>(); buf.next(1); buf.next(2); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryTest.java index e2db70633a..4de1cfb8b0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryTest.java @@ -63,7 +63,7 @@ public void subscribe(Subscriber t1) { } }); - TestSubscriber ts = new TestSubscriber(consumer); + TestSubscriber ts = new TestSubscriber<>(consumer); producer.retryWhen(new Function, Flowable>() { @Override @@ -117,7 +117,7 @@ public void retryIndefinitely() { Subscriber subscriber = TestHelper.mockSubscriber(); int numRetries = 20; Flowable origin = Flowable.unsafeCreate(new FuncWithErrors(numRetries)); - origin.retry().subscribe(new TestSubscriber(subscriber)); + origin.retry().subscribe(new TestSubscriber<>(subscriber)); InOrder inOrder = inOrder(subscriber); // should show 3 attempts @@ -136,7 +136,7 @@ public void schedulingNotificationHandler() { Subscriber subscriber = TestHelper.mockSubscriber(); int numRetries = 2; Flowable origin = Flowable.unsafeCreate(new FuncWithErrors(numRetries)); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); origin.retryWhen(new Function, Flowable>() { @Override public Flowable apply(Flowable t1) { @@ -203,7 +203,7 @@ public Integer apply(Throwable t1) { public void onCompletedFromNotificationHandler() { Subscriber subscriber = TestHelper.mockSubscriber(); Flowable origin = Flowable.unsafeCreate(new FuncWithErrors(1)); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); origin.retryWhen(new Function, Flowable>() { @Override public Flowable apply(Flowable t1) { @@ -498,7 +498,7 @@ public void cancel() { public void sourceFlowableCallsUnsubscribe() throws InterruptedException { final AtomicInteger subsCount = new AtomicInteger(0); - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Publisher onSubscribe = new Publisher() { @Override @@ -529,7 +529,7 @@ public void subscribe(Subscriber s) { public void sourceFlowableRetry1() throws InterruptedException { final AtomicInteger subsCount = new AtomicInteger(0); - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Publisher onSubscribe = new Publisher() { @Override @@ -548,7 +548,7 @@ public void subscribe(Subscriber s) { public void sourceFlowableRetry0() throws InterruptedException { final AtomicInteger subsCount = new AtomicInteger(0); - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Publisher onSubscribe = new Publisher() { @Override @@ -674,7 +674,7 @@ public void unsubscribeAfterError() { SlowFlowable so = new SlowFlowable(100, 0, "testUnsubscribeAfterError"); Flowable f = Flowable.unsafeCreate(so).retry(5); - AsyncSubscriber async = new AsyncSubscriber(subscriber); + AsyncSubscriber async = new AsyncSubscriber<>(subscriber); f.subscribe(async); @@ -698,7 +698,7 @@ public void timeoutWithRetry() { SlowFlowable sf = new SlowFlowable(100, 10, "testTimeoutWithRetry"); Flowable f = Flowable.unsafeCreate(sf).timeout(80, TimeUnit.MILLISECONDS).retry(5); - AsyncSubscriber async = new AsyncSubscriber(subscriber); + AsyncSubscriber async = new AsyncSubscriber<>(subscriber); f.subscribe(async); @@ -720,7 +720,7 @@ public void retryWithBackpressure() throws InterruptedException { for (int i = 0; i < 400; i++) { Subscriber subscriber = TestHelper.mockSubscriber(); Flowable origin = Flowable.unsafeCreate(new FuncWithErrors(numRetries)); - TestSubscriberEx ts = new TestSubscriberEx(subscriber); + TestSubscriberEx ts = new TestSubscriberEx<>(subscriber); origin.retry().observeOn(Schedulers.computation()).subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); @@ -751,7 +751,7 @@ public void retryWithBackpressureParallel() throws InterruptedException { } final AtomicInteger timeouts = new AtomicInteger(); - final Map> data = new ConcurrentHashMap>(); + final Map> data = new ConcurrentHashMap<>(); int m = 5000; final CountDownLatch cdl = new CountDownLatch(m); @@ -763,11 +763,11 @@ public void run() { final AtomicInteger nexts = new AtomicInteger(); try { Flowable origin = Flowable.unsafeCreate(new FuncWithErrors(numRetries)); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); origin.retry() .observeOn(Schedulers.computation()).subscribe(ts); ts.awaitDone(2500, TimeUnit.MILLISECONDS); - List onNextEvents = new ArrayList(ts.values()); + List onNextEvents = new ArrayList<>(ts.values()); if (onNextEvents.size() != numRetries + 2) { for (Throwable t : ts.errors()) { onNextEvents.add(t.toString()); @@ -865,7 +865,7 @@ public Flowable apply(GroupedFlowable t1) { return t1.take(1); } }, NUM_MSG) // Must request as many groups as groupBy produces to avoid MBE - .subscribe(new TestSubscriber(subscriber)); + .subscribe(new TestSubscriber<>(subscriber)); InOrder inOrder = inOrder(subscriber); // should show 3 attempts @@ -910,7 +910,7 @@ public Flowable apply(GroupedFlowable t1) { return t1.take(1); } }) - .subscribe(new TestSubscriber(subscriber)); + .subscribe(new TestSubscriber<>(subscriber)); InOrder inOrder = inOrder(subscriber); // should show 3 attempts diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryWithPredicateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryWithPredicateTest.java index 9a69dd3ede..b70b742201 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryWithPredicateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRetryWithPredicateTest.java @@ -236,7 +236,7 @@ public void unsubscribeAfterError() { .unsafeCreate(so) .retry(retry5); - FlowableRetryTest.AsyncSubscriber async = new FlowableRetryTest.AsyncSubscriber(subscriber); + FlowableRetryTest.AsyncSubscriber async = new FlowableRetryTest.AsyncSubscriber<>(subscriber); f.subscribe(async); @@ -263,7 +263,7 @@ public void timeoutWithRetry() { .timeout(80, TimeUnit.MILLISECONDS) .retry(retry5); - FlowableRetryTest.AsyncSubscriber async = new FlowableRetryTest.AsyncSubscriber(subscriber); + FlowableRetryTest.AsyncSubscriber async = new FlowableRetryTest.AsyncSubscriber<>(subscriber); f.subscribe(async); @@ -279,7 +279,7 @@ public void timeoutWithRetry() { @Test public void issue2826() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); final RuntimeException e = new RuntimeException("You shall not pass"); final AtomicInteger c = new AtomicInteger(); Flowable.just(1).map(new Function() { @@ -313,7 +313,7 @@ public Integer apply(Integer t1) { @Test public void issue3008RetryWithPredicate() { - final List list = new CopyOnWriteArrayList(); + final List list = new CopyOnWriteArrayList<>(); final AtomicBoolean isFirst = new AtomicBoolean(true); Flowable. just(1L, 2L, 3L).map(new Function() { @Override @@ -341,7 +341,7 @@ public void accept(Long t) { @Test public void issue3008RetryInfinite() { - final List list = new CopyOnWriteArrayList(); + final List list = new CopyOnWriteArrayList<>(); final AtomicBoolean isFirst = new AtomicBoolean(true); Flowable. just(1L, 2L, 3L).map(new Function() { @Override @@ -365,7 +365,7 @@ public void accept(Long t) { @Test public void backpressure() { - final List requests = new ArrayList(); + final List requests = new ArrayList<>(); Flowable source = Flowable .just(1) @@ -377,7 +377,7 @@ public void accept(long t) { } }); - TestSubscriber ts = new TestSubscriber(3L); + TestSubscriber ts = new TestSubscriber<>(3L); source .retry(new BiPredicate() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScalarXMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScalarXMapTest.java index 60ddbbff52..a4abfce00c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScalarXMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScalarXMapTest.java @@ -59,7 +59,7 @@ public Integer get() throws Exception { static final class OneCallablePublisher implements Publisher, Supplier { @Override public void subscribe(Subscriber s) { - s.onSubscribe(new ScalarSubscription(s, 1)); + s.onSubscribe(new ScalarSubscription<>(s, 1)); } @Override @@ -70,7 +70,7 @@ public Integer get() throws Exception { @Test public void tryScalarXMap() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); assertTrue(FlowableScalarXMap.tryScalarXMapSubscribe(new CallablePublisher(), ts, new Function>() { @Override public Publisher apply(Integer f) throws Exception { @@ -83,7 +83,7 @@ public Publisher apply(Integer f) throws Exception { @Test public void emptyXMap() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); assertTrue(FlowableScalarXMap.tryScalarXMapSubscribe(new EmptyCallablePublisher(), ts, new Function>() { @Override @@ -97,7 +97,7 @@ public Publisher apply(Integer f) throws Exception { @Test public void mapperCrashes() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); assertTrue(FlowableScalarXMap.tryScalarXMapSubscribe(new OneCallablePublisher(), ts, new Function>() { @Override @@ -111,7 +111,7 @@ public Publisher apply(Integer f) throws Exception { @Test public void mapperToJust() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); assertTrue(FlowableScalarXMap.tryScalarXMapSubscribe(new OneCallablePublisher(), ts, new Function>() { @Override @@ -125,7 +125,7 @@ public Publisher apply(Integer f) throws Exception { @Test public void mapperToEmpty() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); assertTrue(FlowableScalarXMap.tryScalarXMapSubscribe(new OneCallablePublisher(), ts, new Function>() { @Override @@ -139,7 +139,7 @@ public Publisher apply(Integer f) throws Exception { @Test public void mapperToCrashingCallable() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); assertTrue(FlowableScalarXMap.tryScalarXMapSubscribe(new OneCallablePublisher(), ts, new Function>() { @Override @@ -177,8 +177,8 @@ public Publisher apply(Integer v) throws Exception { @Test public void scalarDisposableStateCheck() { - TestSubscriber ts = new TestSubscriber(); - ScalarSubscription sd = new ScalarSubscription(ts, 1); + TestSubscriber ts = new TestSubscriber<>(); + ScalarSubscription sd = new ScalarSubscription<>(ts, 1); ts.onSubscribe(sd); assertFalse(sd.isCancelled()); @@ -211,8 +211,8 @@ public void scalarDisposableStateCheck() { @Test public void scalarDisposableRunDisposeRace() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { - TestSubscriber ts = new TestSubscriber(); - final ScalarSubscription sd = new ScalarSubscription(ts, 1); + TestSubscriber ts = new TestSubscriber<>(); + final ScalarSubscription sd = new ScalarSubscription<>(ts, 1); ts.onSubscribe(sd); Runnable r1 = new Runnable() { @@ -235,7 +235,7 @@ public void run() { @Test public void cancelled() { - ScalarSubscription scalar = new ScalarSubscription(new TestSubscriber(), 1); + ScalarSubscription scalar = new ScalarSubscription<>(new TestSubscriber<>(), 1); assertFalse(scalar.isCancelled()); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScanTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScanTest.java index f918d152be..2988da7570 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScanTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableScanTest.java @@ -114,7 +114,7 @@ public Integer apply(Integer t1, Integer t2) { @Test public void shouldNotEmitUntilAfterSubscription() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 100).scan(0, new BiFunction() { @Override @@ -263,7 +263,7 @@ public void seedFactory() { @Override public List get() { - return new ArrayList(); + return new ArrayList<>(); } }, new BiConsumer, Integer>() { @@ -289,7 +289,7 @@ public void seedFactoryFlowable() { @Override public List get() { - return new ArrayList(); + return new ArrayList<>(); } }, new BiConsumer, Integer>() { @@ -315,7 +315,7 @@ public Integer apply(Integer t1, Integer t2) { } }).take(1); - TestSubscriberEx subscriber = new TestSubscriberEx(); + TestSubscriberEx subscriber = new TestSubscriberEx<>(); f.subscribe(subscriber); subscriber.assertValue(0); subscriber.assertTerminated(); @@ -324,7 +324,7 @@ public Integer apply(Integer t1, Integer t2) { @Test public void scanShouldNotRequestZero() { - final AtomicReference producer = new AtomicReference(); + final AtomicReference producer = new AtomicReference<>(); Flowable f = Flowable.unsafeCreate(new Publisher() { @Override public void subscribe(final Subscriber subscriber) { @@ -445,7 +445,7 @@ public Integer apply(Integer a, Integer b) throws Exception { public void unsubscribeScan() { FlowableEventStream.getEventStream("HTTP-ClusterB", 20) - .scan(new HashMap(), new BiFunction, Event, HashMap>() { + .scan(new HashMap<>(), new BiFunction, Event, HashMap>() { @Override public HashMap apply(HashMap accum, Event perInstanceEvent) { accum.put("instance", perInstanceEvent.instanceId); @@ -463,7 +463,7 @@ public void accept(HashMap v) { @Test public void scanWithSeedDoesNotEmitErrorTwiceIfScanFunctionThrows() { - final List list = new CopyOnWriteArrayList(); + final List list = new CopyOnWriteArrayList<>(); Consumer errorConsumer = new Consumer() { @Override public void accept(Throwable t) throws Exception { @@ -543,7 +543,7 @@ public void scanNoSeed() { @Test public void scanNoSeedDoesNotEmitErrorTwiceIfScanFunctionThrows() { - final List list = new CopyOnWriteArrayList(); + final List list = new CopyOnWriteArrayList<>(); Consumer errorConsumer = new Consumer() { @Override public void accept(Throwable t) throws Exception { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqualTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqualTest.java index e94bf06167..e5e74e8227 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqualTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSequenceEqualTest.java @@ -384,7 +384,7 @@ protected void subscribeActual(Subscriber s) { }; for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); final PublishProcessor pp = PublishProcessor.create(); @@ -487,7 +487,7 @@ protected void subscribeActual(Subscriber s) { }; for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { - final TestObserver to = new TestObserver(); + final TestObserver to = new TestObserver<>(); final PublishProcessor pp = PublishProcessor.create(); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleTest.java index 3e2fdae2a0..099f63f049 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSingleTest.java @@ -74,7 +74,7 @@ public void singleWithEmptyFlowable() { @Test public void singleDoesNotRequestMoreThanItNeedsIf1Then2RequestedFlowable() { - final List requests = new ArrayList(); + final List requests = new ArrayList<>(); Flowable.just(1) // .doOnRequest(new LongConsumer() { @@ -115,7 +115,7 @@ public void onNext(Integer t) { @Test public void singleDoesNotRequestMoreThanItNeedsIf3RequestedFlowable() { - final List requests = new ArrayList(); + final List requests = new ArrayList<>(); Flowable.just(1) // .doOnRequest(new LongConsumer() { @@ -155,7 +155,7 @@ public void onNext(Integer t) { @Test public void singleRequestsExactlyWhatItNeedsIf1RequestedFlowable() { - final List requests = new ArrayList(); + final List requests = new ArrayList<>(); Flowable.just(1) // .doOnRequest(new LongConsumer() { @@ -705,7 +705,7 @@ public Integer apply(Integer i1, Integer i2) { @Test public void singleElementOperatorDoNotSwallowExceptionWhenDone() { final Throwable exception = new RuntimeException("some error"); - final AtomicReference error = new AtomicReference(); + final AtomicReference error = new AtomicReference<>(); try { RxJavaPlugins.setErrorHandler(new Consumer() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTest.java index be4230486a..53e4e24a93 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipLastTest.java @@ -89,7 +89,7 @@ public void skipLastWithZeroCount() { @Test public void skipLastWithBackpressure() { Flowable f = Flowable.range(0, Flowable.bufferSize() * 2).skipLast(Flowable.bufferSize() + 10); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); f.observeOn(Schedulers.computation()).subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); ts.assertNoErrors(); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipTest.java index 26128e5889..deb672124a 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipTest.java @@ -143,7 +143,7 @@ public void skipError() { @Test public void backpressureMultipleSmallAsyncRequests() throws InterruptedException { final AtomicLong requests = new AtomicLong(0); - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); Flowable.interval(100, TimeUnit.MILLISECONDS) .doOnRequest(new LongConsumer() { @Override @@ -162,7 +162,7 @@ public void accept(long n) { @Test public void requestOverflowDoesNotOccur() { - TestSubscriberEx ts = new TestSubscriberEx(Long.MAX_VALUE - 1); + TestSubscriberEx ts = new TestSubscriberEx<>(Long.MAX_VALUE - 1); Flowable.range(1, 10).skip(5).subscribe(ts); ts.assertTerminated(); ts.assertComplete(); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSubscribeOnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSubscribeOnTest.java index a10283358e..a9f66d733e 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSubscribeOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSubscribeOnTest.java @@ -41,7 +41,7 @@ public void issue813() throws InterruptedException { final CountDownLatch latch = new CountDownLatch(1); final CountDownLatch doneLatch = new CountDownLatch(1); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable .unsafeCreate(new Publisher() { @@ -79,7 +79,7 @@ public void subscribe( @Test public void onError() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); Flowable.unsafeCreate(new Publisher() { @Override @@ -152,7 +152,7 @@ public Disposable schedule(@NonNull final Runnable action, final long delayTime, @Test public void unsubscribeInfiniteStream() throws InterruptedException { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); final AtomicInteger count = new AtomicInteger(); Flowable.unsafeCreate(new Publisher() { @@ -178,7 +178,7 @@ public void subscribe(Subscriber sub) { @Test public void backpressureReschedulesCorrectly() throws InterruptedException { final CountDownLatch latch = new CountDownLatch(10); - TestSubscriberEx ts = new TestSubscriberEx(new DefaultSubscriber() { + TestSubscriberEx ts = new TestSubscriberEx<>(new DefaultSubscriber() { @Override public void onComplete() { @@ -208,7 +208,7 @@ public void onNext(Integer t) { @Test public void setProducerSynchronousRequest() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.just(1, 2, 3).lift(new FlowableOperator() { @Override @@ -283,11 +283,11 @@ public void dispose() { public void deferredRequestRace() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { - final TestSubscriber ts = new TestSubscriber(0L); + final TestSubscriber ts = new TestSubscriber<>(0L); Worker w = Schedulers.computation().createWorker(); - final SubscribeOnSubscriber so = new SubscribeOnSubscriber(ts, w, Flowable.never(), true); + final SubscribeOnSubscriber so = new SubscribeOnSubscriber<>(ts, w, Flowable.never(), true); ts.onSubscribe(so); final BooleanSubscription bs = new BooleanSubscription(); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchIfEmptyTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchIfEmptyTest.java index 9ee55f4dfa..de348ee6a0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchIfEmptyTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchIfEmptyTest.java @@ -142,7 +142,7 @@ public void subscribe(final Subscriber subscriber) { @Test public void switchRequestAlternativeObservableWithBackpressure() { - TestSubscriber ts = new TestSubscriber(1L); + TestSubscriber ts = new TestSubscriber<>(1L); Flowable.empty().switchIfEmpty(Flowable.just(1, 2, 3)).subscribe(ts); @@ -156,7 +156,7 @@ public void switchRequestAlternativeObservableWithBackpressure() { @Test public void backpressureNoRequest() { - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); Flowable.empty().switchIfEmpty(Flowable.just(1, 2, 3)).subscribe(ts); ts.assertNoValues(); ts.assertNoErrors(); @@ -164,7 +164,7 @@ public void backpressureNoRequest() { @Test public void backpressureOnFirstObservable() { - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); Flowable.just(1, 2, 3).switchIfEmpty(Flowable.just(4, 5, 6)).subscribe(ts); ts.assertNotComplete(); ts.assertNoErrors(); @@ -173,7 +173,7 @@ public void backpressureOnFirstObservable() { @Test public void requestsNotLost() throws InterruptedException { - final TestSubscriber ts = new TestSubscriber(0L); + final TestSubscriber ts = new TestSubscriber<>(0L); Flowable.unsafeCreate(new Publisher() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchTest.java index fa83213599..fb571c1109 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSwitchTest.java @@ -450,7 +450,7 @@ public void backpressure() { publishCompleted(o2, 50); publishCompleted(o3, 55); - final TestSubscriberEx testSubscriber = new TestSubscriberEx(); + final TestSubscriberEx testSubscriber = new TestSubscriberEx<>(); Flowable.switchOnNext(o).subscribe(new DefaultSubscriber() { private int requested; @@ -549,7 +549,7 @@ public void onNext(String t) { @Test public void initialRequestsAreAdditive() { - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); Flowable.switchOnNext( Flowable.interval(100, TimeUnit.MILLISECONDS) .map( @@ -568,7 +568,7 @@ public Flowable apply(Long t) { @Test public void initialRequestsDontOverflow() { - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); Flowable.switchOnNext( Flowable.interval(100, TimeUnit.MILLISECONDS) .map(new Function>() { @@ -585,7 +585,7 @@ public Flowable apply(Long t) { @Test public void secondaryRequestsDontOverflow() throws InterruptedException { - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); Flowable.switchOnNext( Flowable.interval(100, TimeUnit.MILLISECONDS) .map(new Function>() { @@ -639,7 +639,7 @@ public void delayErrors() { @Test public void switchOnNextPrefetch() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); Flowable source = Flowable.range(1, 10).hide().doOnNext(new Consumer() { @Override @@ -656,7 +656,7 @@ public void accept(Integer v) throws Exception { @Test public void switchOnNextDelayError() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); Flowable source = Flowable.range(1, 10).hide().doOnNext(new Consumer() { @Override @@ -673,7 +673,7 @@ public void accept(Integer v) throws Exception { @Test public void switchOnNextDelayErrorPrefetch() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); Flowable source = Flowable.range(1, 10).hide().doOnNext(new Consumer() { @Override @@ -1082,7 +1082,7 @@ protected void subscribeActual(Subscriber s) { @Test public void drainCancelRace() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); final PublishProcessor pp = PublishProcessor.create(); @@ -1176,7 +1176,7 @@ public Object apply(Integer w) throws Exception { public void undeliverableUponCancel() { List errors = TestHelper.trackPluginErrors(); try { - final TestSubscriberEx ts = new TestSubscriberEx(); + final TestSubscriberEx ts = new TestSubscriberEx<>(); Flowable.just(1) .map(new Function() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastOneTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastOneTest.java index 8acf9c3026..373fe4fbe4 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastOneTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastOneTest.java @@ -30,7 +30,7 @@ public class FlowableTakeLastOneTest extends RxJavaTest { @Test public void lastOfManyReturnsLast() { - TestSubscriberEx s = new TestSubscriberEx(); + TestSubscriberEx s = new TestSubscriberEx<>(); Flowable.range(1, 10).takeLast(1).subscribe(s); s.assertValue(10); s.assertNoErrors(); @@ -41,7 +41,7 @@ public void lastOfManyReturnsLast() { @Test public void lastOfEmptyReturnsEmpty() { - TestSubscriberEx s = new TestSubscriberEx(); + TestSubscriberEx s = new TestSubscriberEx<>(); Flowable.empty().takeLast(1).subscribe(s); s.assertNoValues(); s.assertNoErrors(); @@ -52,7 +52,7 @@ public void lastOfEmptyReturnsEmpty() { @Test public void lastOfOneReturnsLast() { - TestSubscriberEx s = new TestSubscriberEx(); + TestSubscriberEx s = new TestSubscriberEx<>(); Flowable.just(1).takeLast(1).subscribe(s); s.assertValue(1); s.assertNoErrors(); @@ -81,7 +81,7 @@ public void run() { @Test public void lastWithBackpressure() { - MySubscriber s = new MySubscriber(0); + MySubscriber s = new MySubscriber<>(0); Flowable.just(1).takeLast(1).subscribe(s); assertEquals(0, s.list.size()); s.requestMore(1); @@ -111,7 +111,7 @@ private static class MySubscriber extends DefaultSubscriber { this.initialRequest = initialRequest; } - final List list = new ArrayList(); + final List list = new ArrayList<>(); public void requestMore(long n) { request(n); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTest.java index 764e932405..c62ff85db0 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTest.java @@ -96,7 +96,7 @@ public void takeLastWithNegativeCount() { @Test public void backpressure1() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 100000).takeLast(1) .observeOn(Schedulers.newThread()) .map(newSlowProcessor()).subscribe(ts); @@ -107,7 +107,7 @@ public void backpressure1() { @Test public void backpressure2() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.range(1, 100000).takeLast(Flowable.bufferSize() * 4) .observeOn(Schedulers.newThread()).map(newSlowProcessor()).subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); @@ -283,7 +283,7 @@ public void onNext(Integer integer) { @Test public void requestOverflow() { - final List list = new ArrayList(); + final List list = new ArrayList<>(); Flowable.range(1, 100).takeLast(50).subscribe(new DefaultSubscriber() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTimedTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTimedTest.java index 745cdf01dd..3f8c22a47f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTimedTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTimedTest.java @@ -208,7 +208,7 @@ public void takeLastTimedWithZeroCapacity() { public void continuousDelivery() { TestScheduler scheduler = new TestScheduler(); - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); PublishProcessor pp = PublishProcessor.create(); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTest.java index 3174c62721..fa9ea0725d 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTest.java @@ -290,7 +290,7 @@ public void subscribe(Subscriber op) { @Test public void takeObserveOn() { Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); INFINITE_OBSERVABLE.onBackpressureDrop() .observeOn(Schedulers.newThread()).take(1).subscribe(ts); @@ -305,7 +305,7 @@ public void takeObserveOn() { @Test public void producerRequestThroughTake() { - TestSubscriber ts = new TestSubscriber(3); + TestSubscriber ts = new TestSubscriber<>(3); final AtomicLong requested = new AtomicLong(); Flowable.unsafeCreate(new Publisher() { @@ -331,7 +331,7 @@ public void cancel() { @Test public void producerRequestThroughTakeIsModified() { - TestSubscriber ts = new TestSubscriber(3); + TestSubscriber ts = new TestSubscriber<>(3); final AtomicLong requested = new AtomicLong(); Flowable.unsafeCreate(new Publisher() { @@ -358,7 +358,7 @@ public void cancel() { @Test public void interrupt() throws InterruptedException { - final AtomicReference exception = new AtomicReference(); + final AtomicReference exception = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); Flowable.just(1).subscribeOn(Schedulers.computation()).take(1) .subscribe(new Consumer() { @@ -384,7 +384,7 @@ public void accept(Integer t1) { @Test public void doesntRequestMoreThanNeededFromUpstream() throws InterruptedException { final AtomicLong requests = new AtomicLong(); - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); Flowable.interval(100, TimeUnit.MILLISECONDS) // .doOnRequest(new LongConsumer() { @@ -429,7 +429,7 @@ public void onNext(Integer t) { public void reentrantTake() { final PublishProcessor source = PublishProcessor.create(); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); source.take(1).doOnNext(new Consumer() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTest2.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTest2.java index 14987ce16a..089c148099 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTest2.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeTest2.java @@ -32,7 +32,7 @@ // moved tests from FlowableLimitTest to here (limit removed as operator) public class FlowableTakeTest2 extends RxJavaTest implements LongConsumer, Action { - final List requests = new ArrayList(); + final List requests = new ArrayList<>(); static final Long CANCELLED = -100L; diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilPredicateTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilPredicateTest.java index 4bdda03eb1..4019ec4fd9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilPredicateTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilPredicateTest.java @@ -142,7 +142,7 @@ public boolean test(Integer v) { @Test public void backpressure() { - TestSubscriber ts = new TestSubscriber(5L); + TestSubscriber ts = new TestSubscriber<>(5L); Flowable.range(1, 1000).takeUntil(new Predicate() { @Override @@ -158,7 +158,7 @@ public boolean test(Integer v) { @Test public void errorIncludesLastValueAsCause() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); final TestException e = new TestException("Forced failure"); Predicate predicate = new Predicate() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilTest.java index 7db84c13d8..150143ba6f 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeUntilTest.java @@ -190,7 +190,7 @@ public void untilFires() { PublishProcessor source = PublishProcessor.create(); PublishProcessor until = PublishProcessor.create(); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); source.takeUntil(until).subscribe(ts); @@ -216,7 +216,7 @@ public void mainCompletes() { PublishProcessor source = PublishProcessor.create(); PublishProcessor until = PublishProcessor.create(); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); source.takeUntil(until).subscribe(ts); @@ -240,7 +240,7 @@ public void downstreamUnsubscribes() { PublishProcessor source = PublishProcessor.create(); PublishProcessor until = PublishProcessor.create(); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); source.takeUntil(until).take(1).subscribe(ts); @@ -262,7 +262,7 @@ public void downstreamUnsubscribes() { public void backpressure() { PublishProcessor until = PublishProcessor.create(); - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); Flowable.range(1, 10).takeUntil(until).subscribe(ts); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeWhileTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeWhileTest.java index 90f9cc4a59..f2c964cf28 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeWhileTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeWhileTest.java @@ -236,7 +236,7 @@ public boolean test(Integer t1) { return t1 < 100; } }); - TestSubscriber ts = new TestSubscriber(5L); + TestSubscriber ts = new TestSubscriber<>(5L); source.subscribe(ts); @@ -257,7 +257,7 @@ public boolean test(Integer t1) { return t1 < 2; } }); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); source.subscribe(ts); @@ -269,7 +269,7 @@ public boolean test(Integer t1) { @Test public void errorCauseIncludesLastValue() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); Flowable.just("abc").takeWhile(new Predicate() { @Override public boolean test(String t1) { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeIntervalTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeIntervalTest.java index ac517661cb..496bce4a38 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeIntervalTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeIntervalTest.java @@ -61,11 +61,11 @@ public void timeInterval() { processor.onComplete(); inOrder.verify(subscriber, times(1)).onNext( - new Timed(1, 1000, TIME_UNIT)); + new Timed<>(1, 1000, TIME_UNIT)); inOrder.verify(subscriber, times(1)).onNext( - new Timed(2, 2000, TIME_UNIT)); + new Timed<>(2, 2000, TIME_UNIT)); inOrder.verify(subscriber, times(1)).onNext( - new Timed(3, 3000, TIME_UNIT)); + new Timed<>(3, 3000, TIME_UNIT)); inOrder.verify(subscriber, times(1)).onComplete(); inOrder.verifyNoMoreInteractions(); } diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutTests.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutTests.java index 144d0da6a8..88a3bc2253 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutTests.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutTests.java @@ -52,7 +52,7 @@ public void setUp() { @Test public void shouldNotTimeoutIfOnNextWithinTimeout() { Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); withTimeout.subscribe(ts); @@ -67,7 +67,7 @@ public void shouldNotTimeoutIfOnNextWithinTimeout() { @Test public void shouldNotTimeoutIfSecondOnNextWithinTimeout() { Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); withTimeout.subscribe(ts); @@ -83,7 +83,7 @@ public void shouldNotTimeoutIfSecondOnNextWithinTimeout() { @Test public void shouldTimeoutIfOnNextNotWithinTimeout() { - TestSubscriberEx subscriber = new TestSubscriberEx(); + TestSubscriberEx subscriber = new TestSubscriberEx<>(); withTimeout.subscribe(subscriber); @@ -93,8 +93,8 @@ public void shouldTimeoutIfOnNextNotWithinTimeout() { @Test public void shouldTimeoutIfSecondOnNextNotWithinTimeout() { - TestSubscriberEx subscriber = new TestSubscriberEx(); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriberEx subscriber = new TestSubscriberEx<>(); + TestSubscriber ts = new TestSubscriber<>(subscriber); withTimeout.subscribe(subscriber); testScheduler.advanceTimeBy(2, TimeUnit.SECONDS); underlyingSubject.onNext("One"); @@ -107,7 +107,7 @@ public void shouldTimeoutIfSecondOnNextNotWithinTimeout() { @Test public void shouldCompleteIfUnderlyingComletes() { Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); withTimeout.subscribe(subscriber); testScheduler.advanceTimeBy(2, TimeUnit.SECONDS); underlyingSubject.onComplete(); @@ -120,7 +120,7 @@ public void shouldCompleteIfUnderlyingComletes() { @Test public void shouldErrorIfUnderlyingErrors() { Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); withTimeout.subscribe(subscriber); testScheduler.advanceTimeBy(2, TimeUnit.SECONDS); underlyingSubject.onError(new UnsupportedOperationException()); @@ -135,7 +135,7 @@ public void shouldSwitchToOtherIfOnNextNotWithinTimeout() { Flowable source = underlyingSubject.timeout(TIMEOUT, TIME_UNIT, testScheduler, other); Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); source.subscribe(ts); testScheduler.advanceTimeBy(2, TimeUnit.SECONDS); @@ -158,7 +158,7 @@ public void shouldSwitchToOtherIfOnErrorNotWithinTimeout() { Flowable source = underlyingSubject.timeout(TIMEOUT, TIME_UNIT, testScheduler, other); Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); source.subscribe(ts); testScheduler.advanceTimeBy(2, TimeUnit.SECONDS); @@ -181,7 +181,7 @@ public void shouldSwitchToOtherIfOnCompletedNotWithinTimeout() { Flowable source = underlyingSubject.timeout(TIMEOUT, TIME_UNIT, testScheduler, other); Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); source.subscribe(ts); testScheduler.advanceTimeBy(2, TimeUnit.SECONDS); @@ -204,7 +204,7 @@ public void shouldSwitchToOtherAndCanBeUnsubscribedIfOnNextNotWithinTimeout() { Flowable source = underlyingSubject.timeout(TIMEOUT, TIME_UNIT, testScheduler, other); Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); source.subscribe(ts); testScheduler.advanceTimeBy(2, TimeUnit.SECONDS); @@ -234,7 +234,7 @@ public void shouldTimeoutIfSynchronizedFlowableEmitFirstOnNextNotWithinTimeout() final CountDownLatch exit = new CountDownLatch(1); final CountDownLatch timeoutSetuped = new CountDownLatch(1); - final TestSubscriberEx subscriber = new TestSubscriberEx(); + final TestSubscriberEx subscriber = new TestSubscriberEx<>(); new Thread(new Runnable() { @@ -283,7 +283,7 @@ public void subscribe(Subscriber subscriber) { TestScheduler testScheduler = new TestScheduler(); Flowable observableWithTimeout = never.timeout(1000, TimeUnit.MILLISECONDS, testScheduler); - TestSubscriberEx subscriber = new TestSubscriberEx(); + TestSubscriberEx subscriber = new TestSubscriberEx<>(); observableWithTimeout.subscribe(subscriber); testScheduler.advanceTimeBy(2000, TimeUnit.MILLISECONDS); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutWithSelectorTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutWithSelectorTest.java index ff0b91113a..7e55fa0d77 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutWithSelectorTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutWithSelectorTest.java @@ -329,7 +329,7 @@ public Void answer(InvocationOnMock invocation) throws Throwable { }).when(subscriber).onComplete(); - final TestSubscriber ts = new TestSubscriber(subscriber); + final TestSubscriber ts = new TestSubscriber<>(subscriber); new Thread(new Runnable() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimerTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimerTest.java index bc8b67d737..e23228f943 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimerTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimerTest.java @@ -63,7 +63,7 @@ public void timerOnce() { @Test public void timerPeriodically() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.interval(100, 100, TimeUnit.MILLISECONDS, scheduler).subscribe(ts); @@ -91,7 +91,7 @@ public void timerPeriodically() { @Test public void interval() { Flowable w = Flowable.interval(1, TimeUnit.SECONDS, scheduler); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); w.subscribe(ts); ts.assertNoValues(); @@ -116,8 +116,8 @@ public void interval() { public void withMultipleSubscribersStartingAtSameTime() { Flowable w = Flowable.interval(1, TimeUnit.SECONDS, scheduler); - TestSubscriber ts1 = new TestSubscriber(); - TestSubscriber ts2 = new TestSubscriber(); + TestSubscriber ts1 = new TestSubscriber<>(); + TestSubscriber ts2 = new TestSubscriber<>(); w.subscribe(ts1); w.subscribe(ts2); @@ -153,7 +153,7 @@ public void withMultipleSubscribersStartingAtSameTime() { public void withMultipleStaggeredSubscribers() { Flowable w = Flowable.interval(1, TimeUnit.SECONDS, scheduler); - TestSubscriber ts1 = new TestSubscriber(); + TestSubscriber ts1 = new TestSubscriber<>(); w.subscribe(ts1); @@ -161,7 +161,7 @@ public void withMultipleStaggeredSubscribers() { scheduler.advanceTimeTo(2, TimeUnit.SECONDS); - TestSubscriber ts2 = new TestSubscriber(); + TestSubscriber ts2 = new TestSubscriber<>(); w.subscribe(ts2); @@ -193,7 +193,7 @@ public void withMultipleStaggeredSubscribers() { public void withMultipleStaggeredSubscribersAndPublish() { ConnectableFlowable w = Flowable.interval(1, TimeUnit.SECONDS, scheduler).publish(); - TestSubscriber ts1 = new TestSubscriber(); + TestSubscriber ts1 = new TestSubscriber<>(); w.subscribe(ts1); w.connect(); @@ -202,7 +202,7 @@ public void withMultipleStaggeredSubscribersAndPublish() { scheduler.advanceTimeTo(2, TimeUnit.SECONDS); - TestSubscriber ts2 = new TestSubscriber(); + TestSubscriber ts2 = new TestSubscriber<>(); w.subscribe(ts2); ts1.assertValues(0L, 1L); @@ -309,7 +309,7 @@ public void backpressureNotReady() { @Test public void timerCancelRace() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); final TestScheduler scheduler = new TestScheduler(); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimestampTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimestampTest.java index 08bbcdc50f..05274da619 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimestampTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimestampTest.java @@ -53,9 +53,9 @@ public void timestampWithScheduler() { InOrder inOrder = inOrder(subscriber); - inOrder.verify(subscriber, times(1)).onNext(new Timed(1, 0, TimeUnit.MILLISECONDS)); - inOrder.verify(subscriber, times(1)).onNext(new Timed(2, 100, TimeUnit.MILLISECONDS)); - inOrder.verify(subscriber, times(1)).onNext(new Timed(3, 200, TimeUnit.MILLISECONDS)); + inOrder.verify(subscriber, times(1)).onNext(new Timed<>(1, 0, TimeUnit.MILLISECONDS)); + inOrder.verify(subscriber, times(1)).onNext(new Timed<>(2, 100, TimeUnit.MILLISECONDS)); + inOrder.verify(subscriber, times(1)).onNext(new Timed<>(3, 200, TimeUnit.MILLISECONDS)); verify(subscriber, never()).onError(any(Throwable.class)); verify(subscriber, never()).onComplete(); @@ -77,9 +77,9 @@ public void timestampWithScheduler2() { InOrder inOrder = inOrder(subscriber); - inOrder.verify(subscriber, times(1)).onNext(new Timed(1, 0, TimeUnit.MILLISECONDS)); - inOrder.verify(subscriber, times(1)).onNext(new Timed(2, 0, TimeUnit.MILLISECONDS)); - inOrder.verify(subscriber, times(1)).onNext(new Timed(3, 200, TimeUnit.MILLISECONDS)); + inOrder.verify(subscriber, times(1)).onNext(new Timed<>(1, 0, TimeUnit.MILLISECONDS)); + inOrder.verify(subscriber, times(1)).onNext(new Timed<>(2, 0, TimeUnit.MILLISECONDS)); + inOrder.verify(subscriber, times(1)).onNext(new Timed<>(3, 200, TimeUnit.MILLISECONDS)); verify(subscriber, never()).onError(any(Throwable.class)); verify(subscriber, never()).onComplete(); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToCompletableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToCompletableTest.java index 84c52ab2c3..cac1fa61b7 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToCompletableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToCompletableTest.java @@ -73,7 +73,7 @@ public void emptyObservable() { @Test public void neverObservable() { - TestSubscriberEx subscriber = new TestSubscriberEx(); + TestSubscriberEx subscriber = new TestSubscriberEx<>(); Completable cmp = Flowable.never().ignoreElements(); cmp.toFlowable().subscribe(subscriber); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToFutureTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToFutureTest.java index 28a61aa223..524a7216e1 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToFutureTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToFutureTest.java @@ -38,7 +38,7 @@ public void success() throws Exception { Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); Flowable.fromFuture(future).subscribe(ts); @@ -60,7 +60,7 @@ public void successOperatesOnSuppliedScheduler() throws Exception { Subscriber subscriber = TestHelper.mockSubscriber(); TestScheduler scheduler = new TestScheduler(); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); Flowable.fromFuture(future, scheduler).subscribe(ts); @@ -80,7 +80,7 @@ public void failure() throws Exception { Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); Flowable.fromFuture(future).subscribe(ts); @@ -101,7 +101,7 @@ public void cancelledBeforeSubscribe() throws Exception { Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); ts.cancel(); Flowable.fromFuture(future).subscribe(ts); @@ -147,7 +147,7 @@ public Object get(long timeout, TimeUnit unit) throws InterruptedException, Exec Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); Flowable futureObservable = Flowable.fromFuture(future); futureObservable.subscribeOn(Schedulers.computation()).subscribe(ts); @@ -163,9 +163,9 @@ public Object get(long timeout, TimeUnit unit) throws InterruptedException, Exec @Test public void backpressure() { - TestSubscriber ts = new TestSubscriber(0); + TestSubscriber ts = new TestSubscriber<>(0); - FutureTask f = new FutureTask(new Runnable() { + FutureTask f = new FutureTask<>(new Runnable() { @Override public void run() { @@ -187,7 +187,7 @@ public void run() { @Test public void withTimeoutNoTimeout() { - FutureTask task = new FutureTask(new Runnable() { + FutureTask task = new FutureTask<>(new Runnable() { @Override public void run() { @@ -207,7 +207,7 @@ public void run() { @Test public void withTimeoutTimeout() { - FutureTask task = new FutureTask(new Runnable() { + FutureTask task = new FutureTask<>(new Runnable() { @Override public void run() { @@ -225,7 +225,7 @@ public void run() { @Test public void withTimeoutNoTimeoutScheduler() { - FutureTask task = new FutureTask(new Runnable() { + FutureTask task = new FutureTask<>(new Runnable() { @Override public void run() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToListTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToListTest.java index 66d2164b70..73d1455d5b 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToListTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToListTest.java @@ -92,7 +92,7 @@ public void listWithBlockingFirstFlowable() { @Test public void backpressureHonoredFlowable() { Flowable> w = Flowable.just(1, 2, 3, 4, 5).toList().toFlowable(); - TestSubscriber> ts = new TestSubscriber>(0L); + TestSubscriber> ts = new TestSubscriber<>(0L); w.subscribe(ts); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToMapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToMapTest.java index 8635158cc3..149a3f893c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToMapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToMapTest.java @@ -54,7 +54,7 @@ public void toMapFlowable() { Flowable> mapped = source.toMap(lengthFunc).toFlowable(); - Map expected = new HashMap(); + Map expected = new HashMap<>(); expected.put(1, "a"); expected.put(2, "bb"); expected.put(3, "ccc"); @@ -73,7 +73,7 @@ public void toMapWithValueSelectorFlowable() { Flowable> mapped = source.toMap(lengthFunc, duplicate).toFlowable(); - Map expected = new HashMap(); + Map expected = new HashMap<>(); expected.put(1, "aa"); expected.put(2, "bbbb"); expected.put(3, "cccccc"); @@ -101,7 +101,7 @@ public Integer apply(String t1) { }; Flowable> mapped = source.toMap(lengthFuncErr).toFlowable(); - Map expected = new HashMap(); + Map expected = new HashMap<>(); expected.put(1, "a"); expected.put(2, "bb"); expected.put(3, "ccc"); @@ -131,7 +131,7 @@ public String apply(String t1) { Flowable> mapped = source.toMap(lengthFunc, duplicateErr).toFlowable(); - Map expected = new HashMap(); + Map expected = new HashMap<>(); expected.put(1, "aa"); expected.put(2, "bbbb"); expected.put(3, "cccccc"); @@ -177,7 +177,7 @@ public String apply(String v) { } }, mapFactory).toFlowable(); - Map expected = new LinkedHashMap(); + Map expected = new LinkedHashMap<>(); expected.put(2, "bb"); expected.put(3, "ccc"); expected.put(4, "dddd"); @@ -213,7 +213,7 @@ public String apply(String v) { } }, mapFactory).toFlowable(); - Map expected = new LinkedHashMap(); + Map expected = new LinkedHashMap<>(); expected.put(2, "bb"); expected.put(3, "ccc"); expected.put(4, "dddd"); @@ -231,7 +231,7 @@ public void toMap() { Single> mapped = source.toMap(lengthFunc); - Map expected = new HashMap(); + Map expected = new HashMap<>(); expected.put(1, "a"); expected.put(2, "bb"); expected.put(3, "ccc"); @@ -249,7 +249,7 @@ public void toMapWithValueSelector() { Single> mapped = source.toMap(lengthFunc, duplicate); - Map expected = new HashMap(); + Map expected = new HashMap<>(); expected.put(1, "aa"); expected.put(2, "bbbb"); expected.put(3, "cccccc"); @@ -276,7 +276,7 @@ public Integer apply(String t1) { }; Single> mapped = source.toMap(lengthFuncErr); - Map expected = new HashMap(); + Map expected = new HashMap<>(); expected.put(1, "a"); expected.put(2, "bb"); expected.put(3, "ccc"); @@ -305,7 +305,7 @@ public String apply(String t1) { Single> mapped = source.toMap(lengthFunc, duplicateErr); - Map expected = new HashMap(); + Map expected = new HashMap<>(); expected.put(1, "aa"); expected.put(2, "bbbb"); expected.put(3, "cccccc"); @@ -350,7 +350,7 @@ public String apply(String v) { } }, mapFactory); - Map expected = new LinkedHashMap(); + Map expected = new LinkedHashMap<>(); expected.put(2, "bb"); expected.put(3, "ccc"); expected.put(4, "dddd"); @@ -385,7 +385,7 @@ public String apply(String v) { } }, mapFactory); - Map expected = new LinkedHashMap(); + Map expected = new LinkedHashMap<>(); expected.put(2, "bb"); expected.put(3, "ccc"); expected.put(4, "dddd"); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToMultimapTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToMultimapTest.java index 2413ed6afe..06e71d6beb 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToMultimapTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToMultimapTest.java @@ -55,7 +55,7 @@ public void toMultimapFlowable() { Flowable>> mapped = source.toMultimap(lengthFunc).toFlowable(); - Map> expected = new HashMap>(); + Map> expected = new HashMap<>(); expected.put(1, Arrays.asList("a", "b")); expected.put(2, Arrays.asList("cc", "dd")); @@ -72,7 +72,7 @@ public void toMultimapWithValueSelectorFlowable() { Flowable>> mapped = source.toMultimap(lengthFunc, duplicate).toFlowable(); - Map> expected = new HashMap>(); + Map> expected = new HashMap<>(); expected.put(1, Arrays.asList("aa", "bb")); expected.put(2, Arrays.asList("cccc", "dddd")); @@ -114,11 +114,11 @@ public String apply(String v) { mapFactory, new Function>() { @Override public Collection apply(Integer e) { - return new ArrayList(); + return new ArrayList<>(); } }).toFlowable(); - Map> expected = new HashMap>(); + Map> expected = new HashMap<>(); expected.put(2, Arrays.asList("cc", "dd")); expected.put(3, Arrays.asList("eee", "fff")); @@ -137,9 +137,9 @@ public void toMultimapWithCollectionFactoryFlowable() { @Override public Collection apply(Integer t1) { if (t1 == 2) { - return new ArrayList(); + return new ArrayList<>(); } else { - return new HashSet(); + return new HashSet<>(); } } }; @@ -153,16 +153,16 @@ public String apply(String v) { Supplier>> mapSupplier = new Supplier>>() { @Override public Map> get() { - return new HashMap>(); + return new HashMap<>(); } }; Flowable>> mapped = source .toMultimap(lengthFunc, identity, mapSupplier, collectionFactory).toFlowable(); - Map> expected = new HashMap>(); + Map> expected = new HashMap<>(); expected.put(2, Arrays.asList("cc", "dd")); - expected.put(3, new HashSet(Arrays.asList("eee"))); + expected.put(3, new HashSet<>(Arrays.asList("eee"))); mapped.subscribe(objectSubscriber); @@ -187,7 +187,7 @@ public Integer apply(String t1) { Flowable>> mapped = source.toMultimap(lengthFuncErr).toFlowable(); - Map> expected = new HashMap>(); + Map> expected = new HashMap<>(); expected.put(1, Arrays.asList("a", "b")); expected.put(2, Arrays.asList("cc", "dd")); @@ -214,7 +214,7 @@ public String apply(String t1) { Flowable>> mapped = source.toMultimap(lengthFunc, duplicateErr).toFlowable(); - Map> expected = new HashMap>(); + Map> expected = new HashMap<>(); expected.put(1, Arrays.asList("aa", "bb")); expected.put(2, Arrays.asList("cccc", "dddd")); @@ -244,7 +244,7 @@ public String apply(String v) { } }, mapFactory).toFlowable(); - Map> expected = new HashMap>(); + Map> expected = new HashMap<>(); expected.put(2, Arrays.asList("cc", "dd")); expected.put(3, Arrays.asList("eee", "fff")); @@ -265,7 +265,7 @@ public Collection apply(Integer t1) { if (t1 == 2) { throw new RuntimeException("Forced failure"); } else { - return new HashSet(); + return new HashSet<>(); } } }; @@ -279,14 +279,14 @@ public String apply(String v) { Supplier>> mapSupplier = new Supplier>>() { @Override public Map> get() { - return new HashMap>(); + return new HashMap<>(); } }; Flowable>> mapped = source.toMultimap(lengthFunc, identity, mapSupplier, collectionFactory).toFlowable(); - Map> expected = new HashMap>(); + Map> expected = new HashMap<>(); expected.put(2, Arrays.asList("cc", "dd")); expected.put(3, Collections.singleton("eee")); @@ -303,7 +303,7 @@ public void toMultimap() { Single>> mapped = source.toMultimap(lengthFunc); - Map> expected = new HashMap>(); + Map> expected = new HashMap<>(); expected.put(1, Arrays.asList("a", "b")); expected.put(2, Arrays.asList("cc", "dd")); @@ -319,7 +319,7 @@ public void toMultimapWithValueSelector() { Single>> mapped = source.toMultimap(lengthFunc, duplicate); - Map> expected = new HashMap>(); + Map> expected = new HashMap<>(); expected.put(1, Arrays.asList("aa", "bb")); expected.put(2, Arrays.asList("cccc", "dddd")); @@ -360,11 +360,11 @@ public String apply(String v) { mapFactory, new Function>() { @Override public Collection apply(Integer e) { - return new ArrayList(); + return new ArrayList<>(); } }); - Map> expected = new HashMap>(); + Map> expected = new HashMap<>(); expected.put(2, Arrays.asList("cc", "dd")); expected.put(3, Arrays.asList("eee", "fff")); @@ -382,9 +382,9 @@ public void toMultimapWithCollectionFactory() { @Override public Collection apply(Integer t1) { if (t1 == 2) { - return new ArrayList(); + return new ArrayList<>(); } else { - return new HashSet(); + return new HashSet<>(); } } }; @@ -398,16 +398,16 @@ public String apply(String v) { Supplier>> mapSupplier = new Supplier>>() { @Override public Map> get() { - return new HashMap>(); + return new HashMap<>(); } }; Single>> mapped = source .toMultimap(lengthFunc, identity, mapSupplier, collectionFactory); - Map> expected = new HashMap>(); + Map> expected = new HashMap<>(); expected.put(2, Arrays.asList("cc", "dd")); - expected.put(3, new HashSet(Arrays.asList("eee"))); + expected.put(3, new HashSet<>(Arrays.asList("eee"))); mapped.subscribe(singleObserver); @@ -431,7 +431,7 @@ public Integer apply(String t1) { Single>> mapped = source.toMultimap(lengthFuncErr); - Map> expected = new HashMap>(); + Map> expected = new HashMap<>(); expected.put(1, Arrays.asList("a", "b")); expected.put(2, Arrays.asList("cc", "dd")); @@ -457,7 +457,7 @@ public String apply(String t1) { Single>> mapped = source.toMultimap(lengthFunc, duplicateErr); - Map> expected = new HashMap>(); + Map> expected = new HashMap<>(); expected.put(1, Arrays.asList("aa", "bb")); expected.put(2, Arrays.asList("cccc", "dddd")); @@ -486,7 +486,7 @@ public String apply(String v) { } }, mapFactory); - Map> expected = new HashMap>(); + Map> expected = new HashMap<>(); expected.put(2, Arrays.asList("cc", "dd")); expected.put(3, Arrays.asList("eee", "fff")); @@ -506,7 +506,7 @@ public Collection apply(Integer t1) { if (t1 == 2) { throw new RuntimeException("Forced failure"); } else { - return new HashSet(); + return new HashSet<>(); } } }; @@ -520,14 +520,14 @@ public String apply(String v) { Supplier>> mapSupplier = new Supplier>>() { @Override public Map> get() { - return new HashMap>(); + return new HashMap<>(); } }; Single>> mapped = source.toMultimap(lengthFunc, identity, mapSupplier, collectionFactory); - Map> expected = new HashMap>(); + Map> expected = new HashMap<>(); expected.put(2, Arrays.asList("cc", "dd")); expected.put(3, Collections.singleton("eee")); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToSortedListTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToSortedListTest.java index 96ec70ef69..6012db0add 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToSortedListTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToSortedListTest.java @@ -72,7 +72,7 @@ public void withFollowingFirstFlowable() { @Test public void backpressureHonoredFlowable() { Flowable> w = Flowable.just(1, 3, 2, 5, 4).toSortedList().toFlowable(); - TestSubscriber> ts = new TestSubscriber>(0L); + TestSubscriber> ts = new TestSubscriber<>(0L); w.subscribe(ts); diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUnsubscribeOnTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUnsubscribeOnTest.java index 6457f5ae26..1f37dbddce 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUnsubscribeOnTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUnsubscribeOnTest.java @@ -38,7 +38,7 @@ public void unsubscribeWhenSubscribeOnAndUnsubscribeOnAreOnSameThread() throws I UIEventLoopScheduler uiEventLoop = new UIEventLoopScheduler(); try { final ThreadSubscription subscription = new ThreadSubscription(); - final AtomicReference subscribeThread = new AtomicReference(); + final AtomicReference subscribeThread = new AtomicReference<>(); Flowable w = Flowable.unsafeCreate(new Publisher() { @Override @@ -54,7 +54,7 @@ public void subscribe(Subscriber t1) { } }); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); w.subscribeOn(uiEventLoop).observeOn(Schedulers.computation()) .unsubscribeOn(uiEventLoop) .take(2) @@ -87,7 +87,7 @@ public void unsubscribeWhenSubscribeOnAndUnsubscribeOnAreOnDifferentThreads() th UIEventLoopScheduler uiEventLoop = new UIEventLoopScheduler(); try { final ThreadSubscription subscription = new ThreadSubscription(); - final AtomicReference subscribeThread = new AtomicReference(); + final AtomicReference subscribeThread = new AtomicReference<>(); Flowable w = Flowable.unsafeCreate(new Publisher() { @Override @@ -103,7 +103,7 @@ public void subscribe(Subscriber t1) { } }); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); w.subscribeOn(Schedulers.newThread()).observeOn(Schedulers.computation()) .unsubscribeOn(uiEventLoop) .take(2) diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUsingTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUsingTest.java index 37d9195175..f32b599df4 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUsingTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUsingTest.java @@ -233,7 +233,7 @@ public Flowable apply(Disposable subscription) { @Test public void usingDisposesEagerlyBeforeCompletion() { - final List events = new ArrayList(); + final List events = new ArrayList<>(); Supplier resourceFactory = createResourceFactory(events); final Action completion = createOnCompletedAction(events); final Action unsub = createUnsubAction(events); @@ -260,7 +260,7 @@ public Flowable apply(Resource resource) { @Test public void usingDoesNotDisposesEagerlyBeforeCompletion() { - final List events = new ArrayList(); + final List events = new ArrayList<>(); Supplier resourceFactory = createResourceFactory(events); final Action completion = createOnCompletedAction(events); final Action unsub = createUnsubAction(events); @@ -287,7 +287,7 @@ public Flowable apply(Resource resource) { @Test public void usingDisposesEagerlyBeforeError() { - final List events = new ArrayList(); + final List events = new ArrayList<>(); Supplier resourceFactory = createResourceFactory(events); final Consumer onError = createOnErrorAction(events); final Action unsub = createUnsubAction(events); @@ -315,7 +315,7 @@ public Flowable apply(Resource resource) { @Test public void usingDoesNotDisposesEagerlyBeforeError() { - final List events = new ArrayList(); + final List events = new ArrayList<>(); final Supplier resourceFactory = createResourceFactory(events); final Consumer onError = createOnErrorAction(events); final Action unsub = createUnsubAction(events); @@ -604,7 +604,7 @@ public Flowable apply(Flowable f) @Test public void eagerDisposedOnComplete() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.using(Functions.justSupplier(1), Functions.justFunction(new Flowable() { @Override @@ -619,7 +619,7 @@ protected void subscribeActual(Subscriber subscriber) { @Test public void eagerDisposedOnError() { - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Flowable.using(Functions.justSupplier(1), Functions.justFunction(new Flowable() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithFlowableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithFlowableTest.java index 8b001803c0..c17e2ccfae 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithFlowableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithFlowableTest.java @@ -43,7 +43,7 @@ public void windowViaFlowableNormal1() { final Subscriber subscriber = TestHelper.mockSubscriber(); - final List> values = new ArrayList>(); + final List> values = new ArrayList<>(); Subscriber> wo = new DefaultSubscriber>() { @Override @@ -100,7 +100,7 @@ public void windowViaFlowableBoundaryCompletes() { final Subscriber subscriber = TestHelper.mockSubscriber(); - final List> values = new ArrayList>(); + final List> values = new ArrayList<>(); Subscriber> wo = new DefaultSubscriber>() { @Override @@ -156,7 +156,7 @@ public void windowViaFlowableBoundaryThrows() { final Subscriber subscriber = TestHelper.mockSubscriber(); - final List> values = new ArrayList>(); + final List> values = new ArrayList<>(); Subscriber> wo = new DefaultSubscriber>() { @Override @@ -206,7 +206,7 @@ public void windowViaFlowableThrows() { final Subscriber subscriber = TestHelper.mockSubscriber(); - final List> values = new ArrayList>(); + final List> values = new ArrayList<>(); Subscriber> wo = new DefaultSubscriber>() { @Override @@ -408,7 +408,7 @@ public Flowable apply( public void mainAndBoundaryBothError() { List errors = TestHelper.trackPluginErrors(); try { - final AtomicReference> ref = new AtomicReference>(); + final AtomicReference> ref = new AtomicReference<>(); TestSubscriberEx> ts = Flowable.error(new TestException("main")) .window(new Flowable() { @@ -447,8 +447,8 @@ public void mainCompleteBoundaryErrorRace() { for (int i = 0; i < TestHelper.RACE_LONG_LOOPS; i++) { List errors = TestHelper.trackPluginErrors(); try { - final AtomicReference> refMain = new AtomicReference>(); - final AtomicReference> ref = new AtomicReference>(); + final AtomicReference> refMain = new AtomicReference<>(); + final AtomicReference> ref = new AtomicReference<>(); TestSubscriberEx> ts = new Flowable() { @Override @@ -497,8 +497,8 @@ public void run() { @Test public void mainNextBoundaryNextRace() { for (int i = 0; i < TestHelper.RACE_LONG_LOOPS; i++) { - final AtomicReference> refMain = new AtomicReference>(); - final AtomicReference> ref = new AtomicReference>(); + final AtomicReference> refMain = new AtomicReference<>(); + final AtomicReference> ref = new AtomicReference<>(); TestSubscriber> ts = new Flowable() { @Override @@ -540,8 +540,8 @@ public void run() { @Test public void takeOneAnotherBoundary() { - final AtomicReference> refMain = new AtomicReference>(); - final AtomicReference> ref = new AtomicReference>(); + final AtomicReference> refMain = new AtomicReference<>(); + final AtomicReference> ref = new AtomicReference<>(); TestSubscriberEx> ts = new Flowable() { @Override @@ -572,8 +572,8 @@ protected void subscribeActual(Subscriber subscriber) { @Test public void disposeMainBoundaryCompleteRace() { for (int i = 0; i < TestHelper.RACE_LONG_LOOPS; i++) { - final AtomicReference> refMain = new AtomicReference>(); - final AtomicReference> ref = new AtomicReference>(); + final AtomicReference> refMain = new AtomicReference<>(); + final AtomicReference> ref = new AtomicReference<>(); final TestSubscriber> ts = new Flowable() { @Override @@ -629,8 +629,8 @@ public void disposeMainBoundaryErrorRace() { final TestException ex = new TestException(); for (int i = 0; i < TestHelper.RACE_LONG_LOOPS; i++) { - final AtomicReference> refMain = new AtomicReference>(); - final AtomicReference> ref = new AtomicReference>(); + final AtomicReference> refMain = new AtomicReference<>(); + final AtomicReference> ref = new AtomicReference<>(); final TestSubscriber> ts = new Flowable() { @Override @@ -709,7 +709,7 @@ public Publisher apply(Flowable w) throws Throwable { public void windowAbandonmentCancelsUpstream() { PublishProcessor pp = PublishProcessor.create(); - final AtomicReference> inner = new AtomicReference>(); + final AtomicReference> inner = new AtomicReference<>(); TestSubscriber> ts = pp.window(Flowable.never()) .doOnNext(new Consumer>() { diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithSizeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithSizeTest.java index 4536d7a8e4..e9a7c77518 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithSizeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithSizeTest.java @@ -99,7 +99,7 @@ public void skipAndCountWindowsWithGaps() { @Test public void windowUnsubscribeNonOverlapping() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); final AtomicInteger count = new AtomicInteger(); Flowable.merge(Flowable.range(1, 10000).doOnNext(new Consumer() { @@ -121,7 +121,7 @@ public void accept(Integer t1) { @Test public void windowUnsubscribeNonOverlappingAsyncSource() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); final AtomicInteger count = new AtomicInteger(); Flowable.merge(Flowable.range(1, 100000) .doOnNext(new Consumer() { @@ -145,7 +145,7 @@ public void accept(Integer t1) { @Test public void windowUnsubscribeOverlapping() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); final AtomicInteger count = new AtomicInteger(); Flowable.merge(Flowable.range(1, 10000).doOnNext(new Consumer() { @@ -164,7 +164,7 @@ public void accept(Integer t1) { @Test public void windowUnsubscribeOverlappingAsyncSource() { - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); final AtomicInteger count = new AtomicInteger(); Flowable.merge(Flowable.range(1, 100000) .doOnNext(new Consumer() { @@ -187,7 +187,7 @@ public void accept(Integer t1) { } private List list(String... args) { - List list = new ArrayList(); + List list = new ArrayList<>(); for (String arg : args) { list.add(arg); } @@ -198,7 +198,7 @@ private List list(String... args) { public void backpressureOuter() { Flowable> source = Flowable.range(1, 10).window(3); - final List list = new ArrayList(); + final List list = new ArrayList<>(); final Subscriber subscriber = TestHelper.mockSubscriber(); @@ -271,7 +271,7 @@ public void subscribe(Subscriber s) { @Test public void takeFlatMapCompletes() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); final int indicator = 999999999; @@ -293,7 +293,7 @@ public Flowable apply(Flowable w) { @SuppressWarnings("unchecked") @Test public void backpressureOuterInexact() { - TestSubscriber> ts = new TestSubscriber>(0L); + TestSubscriber> ts = new TestSubscriber<>(0L); Flowable.range(1, 5) .window(2, 1) @@ -476,7 +476,7 @@ public Publisher apply(Flowable w) throws Throwable { public void windowAbandonmentCancelsUpstreamSize() { PublishProcessor pp = PublishProcessor.create(); - final AtomicReference> inner = new AtomicReference>(); + final AtomicReference> inner = new AtomicReference<>(); TestSubscriber> ts = pp.window(10) .take(1) @@ -530,7 +530,7 @@ public Publisher apply(Flowable w) throws Throwable { public void windowAbandonmentCancelsUpstreamSkip() { PublishProcessor pp = PublishProcessor.create(); - final AtomicReference> inner = new AtomicReference>(); + final AtomicReference> inner = new AtomicReference<>(); TestSubscriber> ts = pp.window(5, 10) .take(1) @@ -584,7 +584,7 @@ public Publisher apply(Flowable w) throws Throwable { public void windowAbandonmentCancelsUpstreamOverlap() { PublishProcessor pp = PublishProcessor.create(); - final AtomicReference> inner = new AtomicReference>(); + final AtomicReference> inner = new AtomicReference<>(); TestSubscriber> ts = pp.window(5, 3) .take(1) diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithStartEndFlowableTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithStartEndFlowableTest.java index 9420794dc5..55db25f654 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithStartEndFlowableTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithStartEndFlowableTest.java @@ -46,8 +46,8 @@ public void before() { @Test public void flowableBasedOpenerAndCloser() { - final List list = new ArrayList(); - final List> lists = new ArrayList>(); + final List list = new ArrayList<>(); + final List> lists = new ArrayList<>(); Flowable source = Flowable.unsafeCreate(new Publisher() { @Override @@ -96,7 +96,7 @@ public void subscribe(Subscriber subscriber) { } private List list(String... args) { - List list = new ArrayList(); + List list = new ArrayList<>(); for (String arg : args) { list.add(arg); } @@ -128,7 +128,7 @@ public void accept(Flowable stringFlowable) { stringFlowable.subscribe(new DefaultSubscriber() { @Override public void onComplete() { - lists.add(new ArrayList(list)); + lists.add(new ArrayList<>(list)); list.clear(); } @@ -153,7 +153,7 @@ public void noUnsubscribeAndNoLeak() { PublishProcessor open = PublishProcessor.create(); final PublishProcessor close = PublishProcessor.create(); - TestSubscriber> ts = new TestSubscriber>(); + TestSubscriber> ts = new TestSubscriber<>(); source.window(open, new Function>() { @Override @@ -197,7 +197,7 @@ public void unsubscribeAll() { PublishProcessor open = PublishProcessor.create(); final PublishProcessor close = PublishProcessor.create(); - TestSubscriber> ts = new TestSubscriber>(); + TestSubscriber> ts = new TestSubscriber<>(); source.window(open, new Function>() { @Override @@ -481,7 +481,7 @@ public Publisher apply(Flowable w) throws Throwable { public void windowAbandonmentCancelsUpstream() { PublishProcessor pp = PublishProcessor.create(); - final AtomicReference> inner = new AtomicReference>(); + final AtomicReference> inner = new AtomicReference<>(); TestSubscriber> ts = pp.window(Flowable.just(1).concatWith(Flowable.never()), Functions.justFunction(Flowable.never())) diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithTimeTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithTimeTest.java index eb72dab5f7..86da1bb09c 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithTimeTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWindowWithTimeTest.java @@ -46,8 +46,8 @@ public void before() { @Test public void timedAndCount() { - final List list = new ArrayList(); - final List> lists = new ArrayList>(); + final List list = new ArrayList<>(); + final List> lists = new ArrayList<>(); Flowable source = Flowable.unsafeCreate(new Publisher() { @Override @@ -82,8 +82,8 @@ public void subscribe(Subscriber subscriber) { @Test public void timed() { - final List list = new ArrayList(); - final List> lists = new ArrayList>(); + final List list = new ArrayList<>(); + final List> lists = new ArrayList<>(); Flowable source = Flowable.unsafeCreate(new Publisher() { @Override @@ -111,7 +111,7 @@ public void subscribe(Subscriber subscriber) { } private List list(String... args) { - List list = new ArrayList(); + List list = new ArrayList<>(); for (String arg : args) { list.add(arg); } @@ -143,7 +143,7 @@ public void accept(Flowable stringFlowable) { stringFlowable.subscribe(new DefaultSubscriber() { @Override public void onComplete() { - lists.add(new ArrayList(list)); + lists.add(new ArrayList<>(list)); list.clear(); } @@ -166,8 +166,8 @@ public void exactWindowSize() { Flowable> source = Flowable.range(1, 10) .window(1, TimeUnit.MINUTES, scheduler, 3); - final List list = new ArrayList(); - final List> lists = new ArrayList>(); + final List list = new ArrayList<>(); + final List> lists = new ArrayList<>(); source.subscribe(observeWindow(list, lists)); @@ -184,7 +184,7 @@ public void exactWindowSize() { @Test public void takeFlatMapCompletes() { - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); final AtomicInteger wip = new AtomicInteger(); @@ -514,7 +514,7 @@ public void overlapBackpressure2() { PublishProcessor pp = PublishProcessor.create(); - final TestSubscriber tsInner = new TestSubscriber(); + final TestSubscriber tsInner = new TestSubscriber<>(); TestSubscriber> ts = pp.window(2, 1, TimeUnit.SECONDS, scheduler) .doOnNext(new Consumer>() { @@ -1204,7 +1204,7 @@ public Publisher apply(Flowable w) throws Throwable { public void windowAbandonmentCancelsUpstreamExactTime() { PublishProcessor pp = PublishProcessor.create(); - final AtomicReference> inner = new AtomicReference>(); + final AtomicReference> inner = new AtomicReference<>(); TestSubscriber> ts = pp.window(10, TimeUnit.MINUTES) .take(1) @@ -1254,7 +1254,7 @@ public Publisher apply(Flowable w) throws Throwable { public void windowAbandonmentCancelsUpstreamExactTimeAndSize() { PublishProcessor pp = PublishProcessor.create(); - final AtomicReference> inner = new AtomicReference>(); + final AtomicReference> inner = new AtomicReference<>(); TestSubscriber> ts = pp.window(10, TimeUnit.MINUTES, 100) .take(1) @@ -1304,7 +1304,7 @@ public Publisher apply(Flowable w) throws Throwable { public void windowAbandonmentCancelsUpstreamExactTimeSkip() { PublishProcessor pp = PublishProcessor.create(); - final AtomicReference> inner = new AtomicReference>(); + final AtomicReference> inner = new AtomicReference<>(); TestSubscriber> ts = pp.window(10, 15, TimeUnit.MINUTES) .take(1) diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFromTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFromTest.java index 20814684da..544ca11bc6 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFromTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableWithLatestFromTest.java @@ -90,7 +90,7 @@ public void emptySource() { Flowable result = source.withLatestFrom(other, COMBINER); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); result.subscribe(ts); @@ -116,7 +116,7 @@ public void emptyOther() { Flowable result = source.withLatestFrom(other, COMBINER); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); result.subscribe(ts); @@ -142,7 +142,7 @@ public void unsubscription() { Flowable result = source.withLatestFrom(other, COMBINER); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); result.subscribe(ts); @@ -169,7 +169,7 @@ public void sourceThrows() { Flowable result = source.withLatestFrom(other, COMBINER); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); result.subscribe(ts); @@ -197,7 +197,7 @@ public void otherThrows() { Flowable result = source.withLatestFrom(other, COMBINER); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); result.subscribe(ts); @@ -225,7 +225,7 @@ public void functionThrows() { Flowable result = source.withLatestFrom(other, COMBINER_ERROR); - TestSubscriberEx ts = new TestSubscriberEx(); + TestSubscriberEx ts = new TestSubscriberEx<>(); result.subscribe(ts); @@ -251,7 +251,7 @@ public void noDownstreamUnsubscribe() { Flowable result = source.withLatestFrom(other, COMBINER); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); result.subscribe(ts); @@ -267,7 +267,7 @@ public void backpressure() { Flowable result = source.withLatestFrom(other, COMBINER); - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); result.subscribe(ts); @@ -319,7 +319,7 @@ public void manySources() { PublishProcessor pp3 = PublishProcessor.create(); PublishProcessor main = PublishProcessor.create(); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); main.withLatestFrom(new Flowable[] { pp1, pp2, pp3 }, toArray) .subscribe(ts); @@ -366,7 +366,7 @@ public void manySourcesIterable() { PublishProcessor pp3 = PublishProcessor.create(); PublishProcessor main = PublishProcessor.create(); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); main.withLatestFrom(Arrays.>asList(pp1, pp2, pp3), toArray) .subscribe(ts); @@ -411,8 +411,8 @@ public void manySourcesIterableSweep() { for (String val : new String[] { "1" /*, null*/ }) { int n = 35; for (int i = 0; i < n; i++) { - List> sources = new ArrayList>(); - List expected = new ArrayList(); + List> sources = new ArrayList<>(); + List expected = new ArrayList<>(); expected.add(val); for (int j = 0; j < i; j++) { @@ -420,7 +420,7 @@ public void manySourcesIterableSweep() { expected.add(String.valueOf(val)); } - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); PublishProcessor main = PublishProcessor.create(); @@ -443,7 +443,7 @@ public void backpressureNoSignal() { PublishProcessor pp1 = PublishProcessor.create(); PublishProcessor pp2 = PublishProcessor.create(); - TestSubscriber ts = new TestSubscriber(0); + TestSubscriber ts = new TestSubscriber<>(0); Flowable.range(1, 10).withLatestFrom(new Flowable[] { pp1, pp2 }, toArray) .subscribe(ts); @@ -465,7 +465,7 @@ public void backpressureWithSignal() { PublishProcessor pp1 = PublishProcessor.create(); PublishProcessor pp2 = PublishProcessor.create(); - TestSubscriber ts = new TestSubscriber(0); + TestSubscriber ts = new TestSubscriber<>(0); Flowable.range(1, 3).withLatestFrom(new Flowable[] { pp1, pp2 }, toArray) .subscribe(ts); @@ -495,7 +495,7 @@ public void backpressureWithSignal() { @Test public void withEmpty() { - TestSubscriber ts = new TestSubscriber(0); + TestSubscriber ts = new TestSubscriber<>(0); Flowable.range(1, 3).withLatestFrom( new Flowable[] { Flowable.just(1), Flowable.empty() }, toArray) @@ -508,7 +508,7 @@ public void withEmpty() { @Test public void withError() { - TestSubscriber ts = new TestSubscriber(0); + TestSubscriber ts = new TestSubscriber<>(0); Flowable.range(1, 3).withLatestFrom( new Flowable[] { Flowable.just(1), Flowable.error(new TestException()) }, toArray) @@ -521,7 +521,7 @@ public void withError() { @Test public void withMainError() { - TestSubscriber ts = new TestSubscriber(0); + TestSubscriber ts = new TestSubscriber<>(0); Flowable.error(new TestException()).withLatestFrom( new Flowable[] { Flowable.just(1), Flowable.just(1) }, toArray) @@ -536,7 +536,7 @@ public void withMainError() { public void with2Others() { Flowable just = Flowable.just(1); - TestSubscriber> ts = new TestSubscriber>(); + TestSubscriber> ts = new TestSubscriber<>(); just.withLatestFrom(just, just, new Function3>() { @Override @@ -555,7 +555,7 @@ public List apply(Integer a, Integer b, Integer c) { public void with3Others() { Flowable just = Flowable.just(1); - TestSubscriber> ts = new TestSubscriber>(); + TestSubscriber> ts = new TestSubscriber<>(); just.withLatestFrom(just, just, just, new Function4>() { @Override @@ -574,7 +574,7 @@ public List apply(Integer a, Integer b, Integer c, Integer d) { public void with4Others() { Flowable just = Flowable.just(1); - TestSubscriber> ts = new TestSubscriber>(); + TestSubscriber> ts = new TestSubscriber<>(); just.withLatestFrom(just, just, just, just, new Function5>() { @Override @@ -609,7 +609,7 @@ public Object apply(Integer a, Integer b, Integer c) throws Exception { @Test public void manyIteratorThrows() { Flowable.just(1) - .withLatestFrom(new CrashingMappedIterable>(1, 100, 100, new Function>() { + .withLatestFrom(new CrashingMappedIterable<>(1, 100, 100, new Function>() { @Override public Flowable apply(Integer v) throws Exception { return Flowable.just(2); @@ -733,7 +733,7 @@ public void singleRequestNotForgottenWhenNoData() { Flowable result = source.withLatestFrom(other, COMBINER); - TestSubscriber ts = new TestSubscriber(0L); + TestSubscriber ts = new TestSubscriber<>(0L); result.subscribe(ts); @@ -794,7 +794,7 @@ public Object apply(Object a, Integer b, Integer c, Integer d) } }); - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Runnable r1 = new Runnable() { @Override @@ -837,7 +837,7 @@ public Object apply(Object a, Integer b, Integer c, Integer d) } }); - final TestSubscriber ts = new TestSubscriber(); + final TestSubscriber ts = new TestSubscriber<>(); Runnable r1 = new Runnable() { @Override diff --git a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipTest.java b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipTest.java index d6921bfd91..d40b3908c9 100644 --- a/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipTest.java +++ b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableZipTest.java @@ -352,7 +352,7 @@ public void aggregatorUnsubscribe() { PublishProcessor r2 = PublishProcessor.create(); /* define a Subscriber to receive aggregated events */ Subscriber subscriber = TestHelper.mockSubscriber(); - TestSubscriber ts = new TestSubscriber(subscriber); + TestSubscriber ts = new TestSubscriber<>(subscriber); Flowable.zip(r1, r2, zipr2).subscribe(ts); @@ -770,7 +770,7 @@ public String apply(Integer a, Integer b) { } }); - final ArrayList list = new ArrayList(); + final ArrayList list = new ArrayList<>(); os.subscribe(new Consumer() { @Override @@ -797,7 +797,7 @@ public String apply(Integer a, Integer b) { } }).take(5); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); os.subscribe(ts); ts.awaitDone(5, TimeUnit.SECONDS); @@ -822,7 +822,7 @@ public String apply(Integer a, Integer b) { } }); - final ArrayList list = new ArrayList(); + final ArrayList list = new ArrayList<>(); os.subscribe(new DefaultSubscriber() { @Override @@ -886,7 +886,7 @@ public String apply(Notification t1, Notification t2) { }); - final ArrayList list = new ArrayList(); + final ArrayList list = new ArrayList<>(); f.subscribe(new Consumer() { @Override @@ -915,7 +915,7 @@ public String apply(Integer t1, String t2) { }); - final ArrayList list = new ArrayList(); + final ArrayList list = new ArrayList<>(); f.subscribe(new Consumer() { @Override @@ -942,7 +942,7 @@ public Object apply(final Object[] args) { } }); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); f.subscribe(ts); ts.awaitDone(200, TimeUnit.MILLISECONDS); ts.assertNoValues(); @@ -976,7 +976,7 @@ public void backpressureSync() { Flowable f1 = createInfiniteFlowable(generatedA); Flowable f2 = createInfiniteFlowable(generatedB); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.zip(f1, f2, new BiFunction() { @Override @@ -1000,7 +1000,7 @@ public void backpressureAsync() { Flowable f1 = createInfiniteFlowable(generatedA).subscribeOn(Schedulers.computation()); Flowable f2 = createInfiniteFlowable(generatedB).subscribeOn(Schedulers.computation()); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.zip(f1, f2, new BiFunction() { @Override @@ -1024,7 +1024,7 @@ public void downstreamBackpressureRequestsWithFiniteSyncFlowables() { Flowable f1 = createInfiniteFlowable(generatedA).take(Flowable.bufferSize() * 2); Flowable f2 = createInfiniteFlowable(generatedB).take(Flowable.bufferSize() * 2); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.zip(f1, f2, new BiFunction() { @Override @@ -1049,7 +1049,7 @@ public void downstreamBackpressureRequestsWithInfiniteAsyncFlowables() { Flowable f1 = createInfiniteFlowable(generatedA).subscribeOn(Schedulers.computation()); Flowable f2 = createInfiniteFlowable(generatedB).subscribeOn(Schedulers.computation()); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.zip(f1, f2, new BiFunction() { @Override @@ -1074,7 +1074,7 @@ public void downstreamBackpressureRequestsWithInfiniteSyncFlowables() { Flowable f1 = createInfiniteFlowable(generatedA); Flowable f2 = createInfiniteFlowable(generatedB); - TestSubscriber ts = new TestSubscriber(); + TestSubscriber ts = new TestSubscriber<>(); Flowable.zip(f1, f2, new BiFunction() { @Override @@ -1189,7 +1189,7 @@ public Integer apply(Integer i1, Integer i2) { return i1 + i2; } }); - List expected = new ArrayList(); + List expected = new ArrayList<>(); for (int i = 0; i < 1026; i++) { expected.add(i * 3); } @@ -1247,7 +1247,7 @@ public Integer apply(Integer t1, Integer t2) { @Test public void zipRequest1() { Flowable src = Flowable.just(1).subscribeOn(Schedulers.computation()); - TestSubscriber ts = new TestSubscriber(1L); + TestSubscriber ts = new TestSubscriber<>(1L); Flowable.zip(src, src, new BiFunction() { @Override @@ -1871,7 +1871,7 @@ public Integer apply(Integer a, Integer b) throws Exception { public void firstErrorPreventsSecondSubscription() { final AtomicInteger counter = new AtomicInteger(); - List> flowableList = new ArrayList>(); + List> flowableList = new ArrayList<>(); flowableList.add(Flowable.create(new FlowableOnSubscribe() { @Override public void subscribe(FlowableEmitter e)