Skip to content

Diamond operators in unit tests, flowable package #6787

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ public void interrupt() {

@Test
public void nextObserverError() {
NextSubscriber<Integer> no = new NextSubscriber<Integer>();
NextSubscriber<Integer> no = new NextSubscriber<>();

List<Throwable> errors = TestHelper.trackPluginErrors();
try {
Expand All @@ -366,7 +366,7 @@ public void nextObserverError() {

@Test
public void nextObserverOnNext() throws Exception {
NextSubscriber<Integer> no = new NextSubscriber<Integer>();
NextSubscriber<Integer> no = new NextSubscriber<>();

no.setWaiting();
no.onNext(Notification.createOnNext(1));
Expand All @@ -379,7 +379,7 @@ public void nextObserverOnNext() throws Exception {

@Test
public void nextObserverOnCompleteOnNext() throws Exception {
NextSubscriber<Integer> no = new NextSubscriber<Integer>();
NextSubscriber<Integer> no = new NextSubscriber<>();

no.setWaiting();
no.onNext(Notification.<Integer>createOnComplete());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ public void remove() {

@Test(expected = UnsupportedOperationException.class)
public void remove() {
BlockingFlowableIterator<Integer> it = new BlockingFlowableIterator<Integer>(128);
BlockingFlowableIterator<Integer> it = new BlockingFlowableIterator<>(128);
it.remove();
}

@Test
public void dispose() {
BlockingFlowableIterator<Integer> it = new BlockingFlowableIterator<Integer>(128);
BlockingFlowableIterator<Integer> it = new BlockingFlowableIterator<>(128);

assertFalse(it.isDisposed());

Expand All @@ -134,7 +134,7 @@ public void dispose() {

@Test
public void interruptWait() {
BlockingFlowableIterator<Integer> it = new BlockingFlowableIterator<Integer>(128);
BlockingFlowableIterator<Integer> it = new BlockingFlowableIterator<>(128);

try {
Thread.currentThread().interrupt();
Expand All @@ -147,7 +147,7 @@ public void interruptWait() {

@Test(expected = NoSuchElementException.class)
public void emptyThrowsNoSuch() {
BlockingFlowableIterator<Integer> it = new BlockingFlowableIterator<Integer>(128);
BlockingFlowableIterator<Integer> it = new BlockingFlowableIterator<>(128);
it.onComplete();
it.next();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public Publisher<Integer> apply(Boolean t1) {

@Test
public void backpressureIfOneRequestedOneShouldBeDelivered() {
TestObserverEx<Boolean> to = new TestObserverEx<Boolean>();
TestObserverEx<Boolean> to = new TestObserverEx<>();

Flowable.empty().all(new Predicate<Object>() {
@Override
Expand All @@ -164,7 +164,7 @@ public boolean test(Object t) {

@Test
public void predicateThrowsExceptionAndValueInCauseMessage() {
TestObserverEx<Boolean> to = new TestObserverEx<Boolean>();
TestObserverEx<Boolean> to = new TestObserverEx<>();

final IllegalArgumentException ex = new IllegalArgumentException();

Expand Down Expand Up @@ -306,7 +306,7 @@ public Publisher<Integer> apply(Boolean t1) {

@Test
public void backpressureIfNoneRequestedNoneShouldBeDeliveredFlowable() {
TestSubscriber<Boolean> ts = new TestSubscriber<Boolean>(0L);
TestSubscriber<Boolean> ts = new TestSubscriber<>(0L);
Flowable.empty().all(new Predicate<Object>() {
@Override
public boolean test(Object t1) {
Expand All @@ -323,7 +323,7 @@ public boolean test(Object t1) {

@Test
public void backpressureIfOneRequestedOneShouldBeDeliveredFlowable() {
TestSubscriberEx<Boolean> ts = new TestSubscriberEx<Boolean>(1L);
TestSubscriberEx<Boolean> ts = new TestSubscriberEx<>(1L);

Flowable.empty().all(new Predicate<Object>() {
@Override
Expand All @@ -343,7 +343,7 @@ public boolean test(Object t) {

@Test
public void predicateThrowsExceptionAndValueInCauseMessageFlowable() {
TestSubscriberEx<Boolean> ts = new TestSubscriberEx<Boolean>();
TestSubscriberEx<Boolean> ts = new TestSubscriberEx<>();

final IllegalArgumentException ex = new IllegalArgumentException();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public void amb3() {
@SuppressWarnings("unchecked")
@Test
public void producerRequestThroughAmb() {
TestSubscriber<Integer> ts = new TestSubscriber<Integer>(0L);
TestSubscriber<Integer> ts = new TestSubscriber<>(0L);
ts.request(3);
final AtomicLong requested1 = new AtomicLong();
final AtomicLong requested2 = new AtomicLong();
Expand Down Expand Up @@ -225,7 +225,7 @@ public void cancel() {

@Test
public void backpressure() {
TestSubscriber<Integer> ts = new TestSubscriber<Integer>();
TestSubscriber<Integer> ts = new TestSubscriber<>();
Flowable.range(0, Flowable.bufferSize() * 2)
.ambWith(Flowable.range(0, Flowable.bufferSize() * 2))
.observeOn(Schedulers.computation()) // observeOn has a backpressured RxRingBuffer
Expand Down Expand Up @@ -254,7 +254,7 @@ public void accept(Subscription s) {
//this stream emits second
Flowable<Integer> f2 = Flowable.just(1).doOnSubscribe(incrementer)
.delay(100, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.computation());
TestSubscriber<Integer> ts = new TestSubscriber<Integer>();
TestSubscriber<Integer> ts = new TestSubscriber<>();
Flowable.ambArray(f1, f2).subscribe(ts);
ts.request(1);
ts.awaitDone(5, TimeUnit.SECONDS);
Expand All @@ -271,7 +271,7 @@ public void secondaryRequestsPropagatedToChildren() throws InterruptedException
//this stream emits second
Flowable<Integer> f2 = Flowable.fromArray(4, 5, 6)
.delay(200, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.computation());
TestSubscriber<Integer> ts = new TestSubscriber<Integer>(1L);
TestSubscriber<Integer> ts = new TestSubscriber<>(1L);

Flowable.ambArray(f1, f2).subscribe(ts);
// before first emission request 20 more
Expand Down Expand Up @@ -309,7 +309,7 @@ public void ambCancelsOthers() {
PublishProcessor<Integer> source2 = PublishProcessor.create();
PublishProcessor<Integer> source3 = PublishProcessor.create();

TestSubscriber<Integer> ts = new TestSubscriber<Integer>();
TestSubscriber<Integer> ts = new TestSubscriber<>();

Flowable.ambArray(source1, source2, source3).subscribe(ts);

Expand All @@ -327,8 +327,8 @@ public void ambCancelsOthers() {

@Test
public void multipleUse() {
TestSubscriber<Long> ts1 = new TestSubscriber<Long>();
TestSubscriber<Long> ts2 = new TestSubscriber<Long>();
TestSubscriber<Long> ts1 = new TestSubscriber<>();
TestSubscriber<Long> ts2 = new TestSubscriber<>();

Flowable<Long> amb = Flowable.timer(100, TimeUnit.MILLISECONDS).ambWith(Flowable.timer(200, TimeUnit.MILLISECONDS));

Expand Down Expand Up @@ -541,7 +541,7 @@ public void nullIterableElement() {

@Test
public void iteratorThrows() {
Flowable.amb(new CrashingMappedIterable<Flowable<Integer>>(1, 100, 100, new Function<Integer, Flowable<Integer>>() {
Flowable.amb(new CrashingMappedIterable<>(1, 100, 100, new Function<Integer, Flowable<Integer>>() {
@Override
public Flowable<Integer> apply(Integer v) throws Exception {
return Flowable.never();
Expand All @@ -550,7 +550,7 @@ public Flowable<Integer> apply(Integer v) throws Exception {
.to(TestHelper.<Integer>testConsumer())
.assertFailureAndMessage(TestException.class, "iterator()");

Flowable.amb(new CrashingMappedIterable<Flowable<Integer>>(100, 1, 100, new Function<Integer, Flowable<Integer>>() {
Flowable.amb(new CrashingMappedIterable<>(100, 1, 100, new Function<Integer, Flowable<Integer>>() {
@Override
public Flowable<Integer> apply(Integer v) throws Exception {
return Flowable.never();
Expand All @@ -559,7 +559,7 @@ public Flowable<Integer> apply(Integer v) throws Exception {
.to(TestHelper.<Integer>testConsumer())
.assertFailureAndMessage(TestException.class, "hasNext()");

Flowable.amb(new CrashingMappedIterable<Flowable<Integer>>(100, 100, 1, new Function<Integer, Flowable<Integer>>() {
Flowable.amb(new CrashingMappedIterable<>(100, 100, 1, new Function<Integer, Flowable<Integer>>() {
@Override
public Flowable<Integer> apply(Integer v) throws Exception {
return Flowable.never();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public Publisher<Integer> apply(Boolean t1) {

@Test
public void backpressureIfOneRequestedOneShouldBeDelivered() {
TestObserverEx<Boolean> to = new TestObserverEx<Boolean>();
TestObserverEx<Boolean> to = new TestObserverEx<>();
Flowable.just(1).any(new Predicate<Integer>() {
@Override
public boolean test(Integer v) {
Expand All @@ -255,7 +255,7 @@ public boolean test(Integer v) {

@Test
public void predicateThrowsExceptionAndValueInCauseMessage() {
TestObserverEx<Boolean> to = new TestObserverEx<Boolean>();
TestObserverEx<Boolean> to = new TestObserverEx<>();
final IllegalArgumentException ex = new IllegalArgumentException();

Flowable.just("Boo!").any(new Predicate<String>() {
Expand Down Expand Up @@ -488,7 +488,7 @@ public Publisher<Integer> apply(Boolean t1) {

@Test
public void backpressureIfNoneRequestedNoneShouldBeDeliveredFlowable() {
TestSubscriber<Boolean> ts = new TestSubscriber<Boolean>(0L);
TestSubscriber<Boolean> ts = new TestSubscriber<>(0L);

Flowable.just(1).any(new Predicate<Integer>() {
@Override
Expand All @@ -505,7 +505,7 @@ public boolean test(Integer t) {

@Test
public void backpressureIfOneRequestedOneShouldBeDeliveredFlowable() {
TestSubscriberEx<Boolean> ts = new TestSubscriberEx<Boolean>(1L);
TestSubscriberEx<Boolean> ts = new TestSubscriberEx<>(1L);
Flowable.just(1).any(new Predicate<Integer>() {
@Override
public boolean test(Integer v) {
Expand All @@ -521,7 +521,7 @@ public boolean test(Integer v) {

@Test
public void predicateThrowsExceptionAndValueInCauseMessageFlowable() {
TestSubscriberEx<Boolean> ts = new TestSubscriberEx<Boolean>();
TestSubscriberEx<Boolean> ts = new TestSubscriberEx<>();
final IllegalArgumentException ex = new IllegalArgumentException();

Flowable.just("Boo!").any(new Predicate<String>() {
Expand Down
Loading