The following issues were found
src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeMaxConcurrentTest.java
86 issues
Line: 32
import io.reactivex.rxjava3.subscribers.TestSubscriber;
import io.reactivex.rxjava3.testsupport.TestSubscriberEx;
public class FlowableMergeMaxConcurrentTest extends RxJavaTest {
@Test
public void whenMaxConcurrentIsOne() {
for (int i = 0; i < 100; i++) {
List<Flowable<String>> os = new ArrayList<>();
Reported by PMD.
Line: 37
@Test
public void whenMaxConcurrentIsOne() {
for (int i = 0; i < 100; i++) {
List<Flowable<String>> 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<String> expected = Arrays.asList("one", "two", "three", "four", "five", "one", "two", "three", "four", "five", "one", "two", "three", "four", "five");
Reported by PMD.
Line: 38
public void whenMaxConcurrentIsOne() {
for (int i = 0; i < 100; i++) {
List<Flowable<String>> 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<String> expected = Arrays.asList("one", "two", "three", "four", "five", "one", "two", "three", "four", "five", "one", "two", "three", "four", "five");
Iterator<String> iter = Flowable.merge(os, 1).blockingIterable().iterator();
Reported by PMD.
Line: 38
public void whenMaxConcurrentIsOne() {
for (int i = 0; i < 100; i++) {
List<Flowable<String>> 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<String> expected = Arrays.asList("one", "two", "three", "four", "five", "one", "two", "three", "four", "five", "one", "two", "three", "four", "five");
Iterator<String> iter = Flowable.merge(os, 1).blockingIterable().iterator();
Reported by PMD.
Line: 38
public void whenMaxConcurrentIsOne() {
for (int i = 0; i < 100; i++) {
List<Flowable<String>> 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<String> expected = Arrays.asList("one", "two", "three", "four", "five", "one", "two", "three", "four", "five", "one", "two", "three", "four", "five");
Iterator<String> iter = Flowable.merge(os, 1).blockingIterable().iterator();
Reported by PMD.
Line: 38
public void whenMaxConcurrentIsOne() {
for (int i = 0; i < 100; i++) {
List<Flowable<String>> 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<String> expected = Arrays.asList("one", "two", "three", "four", "five", "one", "two", "three", "four", "five", "one", "two", "three", "four", "five");
Iterator<String> iter = Flowable.merge(os, 1).blockingIterable().iterator();
Reported by PMD.
Line: 38
public void whenMaxConcurrentIsOne() {
for (int i = 0; i < 100; i++) {
List<Flowable<String>> 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<String> expected = Arrays.asList("one", "two", "three", "four", "five", "one", "two", "three", "four", "five", "one", "two", "three", "four", "five");
Iterator<String> iter = Flowable.merge(os, 1).blockingIterable().iterator();
Reported by PMD.
Line: 38
public void whenMaxConcurrentIsOne() {
for (int i = 0; i < 100; i++) {
List<Flowable<String>> 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<String> expected = Arrays.asList("one", "two", "three", "four", "five", "one", "two", "three", "four", "five", "one", "two", "three", "four", "five");
Iterator<String> iter = Flowable.merge(os, 1).blockingIterable().iterator();
Reported by PMD.
Line: 39
for (int i = 0; i < 100; i++) {
List<Flowable<String>> 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<String> expected = Arrays.asList("one", "two", "three", "four", "five", "one", "two", "three", "four", "five", "one", "two", "three", "four", "five");
Iterator<String> iter = Flowable.merge(os, 1).blockingIterable().iterator();
List<String> actual = new ArrayList<>();
Reported by PMD.
Line: 40
List<Flowable<String>> 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<String> expected = Arrays.asList("one", "two", "three", "four", "five", "one", "two", "three", "four", "five", "one", "two", "three", "four", "five");
Iterator<String> iter = Flowable.merge(os, 1).blockingIterable().iterator();
List<String> actual = new ArrayList<>();
while (iter.hasNext()) {
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableToListTest.java
85 issues
Line: 35
import io.reactivex.rxjava3.subscribers.TestSubscriber;
import io.reactivex.rxjava3.testsupport.TestHelper;
public class FlowableToListTest extends RxJavaTest {
@Test
public void listFlowable() {
Flowable<String> w = Flowable.fromIterable(Arrays.asList("one", "two", "three"));
Flowable<List<String>> flowable = w.toList().toFlowable();
Reported by PMD.
Line: 39
@Test
public void listFlowable() {
Flowable<String> w = Flowable.fromIterable(Arrays.asList("one", "two", "three"));
Flowable<List<String>> flowable = w.toList().toFlowable();
Subscriber<List<String>> subscriber = TestHelper.mockSubscriber();
flowable.subscribe(subscriber);
Reported by PMD.
Line: 39
@Test
public void listFlowable() {
Flowable<String> w = Flowable.fromIterable(Arrays.asList("one", "two", "three"));
Flowable<List<String>> flowable = w.toList().toFlowable();
Subscriber<List<String>> subscriber = TestHelper.mockSubscriber();
flowable.subscribe(subscriber);
Reported by PMD.
Line: 39
@Test
public void listFlowable() {
Flowable<String> w = Flowable.fromIterable(Arrays.asList("one", "two", "three"));
Flowable<List<String>> flowable = w.toList().toFlowable();
Subscriber<List<String>> subscriber = TestHelper.mockSubscriber();
flowable.subscribe(subscriber);
Reported by PMD.
Line: 40
@Test
public void listFlowable() {
Flowable<String> w = Flowable.fromIterable(Arrays.asList("one", "two", "three"));
Flowable<List<String>> flowable = w.toList().toFlowable();
Subscriber<List<String>> subscriber = TestHelper.mockSubscriber();
flowable.subscribe(subscriber);
verify(subscriber, times(1)).onNext(Arrays.asList("one", "two", "three"));
Reported by PMD.
Line: 40
@Test
public void listFlowable() {
Flowable<String> w = Flowable.fromIterable(Arrays.asList("one", "two", "three"));
Flowable<List<String>> flowable = w.toList().toFlowable();
Subscriber<List<String>> subscriber = TestHelper.mockSubscriber();
flowable.subscribe(subscriber);
verify(subscriber, times(1)).onNext(Arrays.asList("one", "two", "three"));
Reported by PMD.
Line: 43
Flowable<List<String>> flowable = w.toList().toFlowable();
Subscriber<List<String>> subscriber = TestHelper.mockSubscriber();
flowable.subscribe(subscriber);
verify(subscriber, times(1)).onNext(Arrays.asList("one", "two", "three"));
verify(subscriber, Mockito.never()).onError(any(Throwable.class));
verify(subscriber, times(1)).onComplete();
}
Reported by PMD.
Line: 45
Subscriber<List<String>> subscriber = TestHelper.mockSubscriber();
flowable.subscribe(subscriber);
verify(subscriber, times(1)).onNext(Arrays.asList("one", "two", "three"));
verify(subscriber, Mockito.never()).onError(any(Throwable.class));
verify(subscriber, times(1)).onComplete();
}
@Test
Reported by PMD.
Line: 46
flowable.subscribe(subscriber);
verify(subscriber, times(1)).onNext(Arrays.asList("one", "two", "three"));
verify(subscriber, Mockito.never()).onError(any(Throwable.class));
verify(subscriber, times(1)).onComplete();
}
@Test
public void listViaFlowableFlowable() {
Reported by PMD.
Line: 47
verify(subscriber, times(1)).onNext(Arrays.asList("one", "two", "three"));
verify(subscriber, Mockito.never()).onError(any(Throwable.class));
verify(subscriber, times(1)).onComplete();
}
@Test
public void listViaFlowableFlowable() {
Flowable<String> w = Flowable.fromIterable(Arrays.asList("one", "two", "three"));
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatDelayErrorTest.java
85 issues
Line: 29
import io.reactivex.rxjava3.subscribers.TestSubscriber;
import io.reactivex.rxjava3.testsupport.TestSubscriberEx;
public class FlowableConcatDelayErrorTest extends RxJavaTest {
@Test
public void mainCompletes() {
PublishProcessor<Integer> source = PublishProcessor.create();
Reported by PMD.
Line: 32
public class FlowableConcatDelayErrorTest extends RxJavaTest {
@Test
public void mainCompletes() {
PublishProcessor<Integer> source = PublishProcessor.create();
TestSubscriber<Integer> ts = TestSubscriber.create();
source.concatMapDelayError(new Function<Integer, Flowable<Integer>>() {
Reported by PMD.
Line: 44
}
}).subscribe(ts);
source.onNext(1);
source.onNext(2);
source.onComplete();
ts.assertValues(1, 2, 2, 3);
ts.assertNoErrors();
Reported by PMD.
Line: 45
}).subscribe(ts);
source.onNext(1);
source.onNext(2);
source.onComplete();
ts.assertValues(1, 2, 2, 3);
ts.assertNoErrors();
ts.assertComplete();
Reported by PMD.
Line: 46
source.onNext(1);
source.onNext(2);
source.onComplete();
ts.assertValues(1, 2, 2, 3);
ts.assertNoErrors();
ts.assertComplete();
}
Reported by PMD.
Line: 48
source.onNext(2);
source.onComplete();
ts.assertValues(1, 2, 2, 3);
ts.assertNoErrors();
ts.assertComplete();
}
@Test
Reported by PMD.
Line: 49
source.onComplete();
ts.assertValues(1, 2, 2, 3);
ts.assertNoErrors();
ts.assertComplete();
}
@Test
public void mainErrors() {
Reported by PMD.
Line: 50
ts.assertValues(1, 2, 2, 3);
ts.assertNoErrors();
ts.assertComplete();
}
@Test
public void mainErrors() {
PublishProcessor<Integer> source = PublishProcessor.create();
Reported by PMD.
Line: 54
}
@Test
public void mainErrors() {
PublishProcessor<Integer> source = PublishProcessor.create();
TestSubscriber<Integer> ts = TestSubscriber.create();
source.concatMapDelayError(new Function<Integer, Flowable<Integer>>() {
Reported by PMD.
Line: 66
}
}).subscribe(ts);
source.onNext(1);
source.onNext(2);
source.onError(new TestException());
ts.assertValues(1, 2, 2, 3);
ts.assertError(TestException.class);
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableIgnoreElementsTest.java
85 issues
Line: 32
import io.reactivex.rxjava3.subscribers.*;
import io.reactivex.rxjava3.testsupport.*;
public class FlowableIgnoreElementsTest extends RxJavaTest {
@Test
public void withEmptyFlowable() {
assertTrue(Flowable.empty().ignoreElements().toFlowable().isEmpty().blockingGet());
}
Reported by PMD.
Line: 36
@Test
public void withEmptyFlowable() {
assertTrue(Flowable.empty().ignoreElements().toFlowable().isEmpty().blockingGet());
}
@Test
public void withNonEmptyFlowable() {
assertTrue(Flowable.just(1, 2, 3).ignoreElements().toFlowable().isEmpty().blockingGet());
Reported by PMD.
Line: 36
@Test
public void withEmptyFlowable() {
assertTrue(Flowable.empty().ignoreElements().toFlowable().isEmpty().blockingGet());
}
@Test
public void withNonEmptyFlowable() {
assertTrue(Flowable.just(1, 2, 3).ignoreElements().toFlowable().isEmpty().blockingGet());
Reported by PMD.
Line: 36
@Test
public void withEmptyFlowable() {
assertTrue(Flowable.empty().ignoreElements().toFlowable().isEmpty().blockingGet());
}
@Test
public void withNonEmptyFlowable() {
assertTrue(Flowable.just(1, 2, 3).ignoreElements().toFlowable().isEmpty().blockingGet());
Reported by PMD.
Line: 36
@Test
public void withEmptyFlowable() {
assertTrue(Flowable.empty().ignoreElements().toFlowable().isEmpty().blockingGet());
}
@Test
public void withNonEmptyFlowable() {
assertTrue(Flowable.just(1, 2, 3).ignoreElements().toFlowable().isEmpty().blockingGet());
Reported by PMD.
Line: 36
@Test
public void withEmptyFlowable() {
assertTrue(Flowable.empty().ignoreElements().toFlowable().isEmpty().blockingGet());
}
@Test
public void withNonEmptyFlowable() {
assertTrue(Flowable.just(1, 2, 3).ignoreElements().toFlowable().isEmpty().blockingGet());
Reported by PMD.
Line: 41
@Test
public void withNonEmptyFlowable() {
assertTrue(Flowable.just(1, 2, 3).ignoreElements().toFlowable().isEmpty().blockingGet());
}
@Test
public void upstreamIsProcessedButIgnoredFlowable() {
final int num = 10;
Reported by PMD.
Line: 41
@Test
public void withNonEmptyFlowable() {
assertTrue(Flowable.just(1, 2, 3).ignoreElements().toFlowable().isEmpty().blockingGet());
}
@Test
public void upstreamIsProcessedButIgnoredFlowable() {
final int num = 10;
Reported by PMD.
Line: 41
@Test
public void withNonEmptyFlowable() {
assertTrue(Flowable.just(1, 2, 3).ignoreElements().toFlowable().isEmpty().blockingGet());
}
@Test
public void upstreamIsProcessedButIgnoredFlowable() {
final int num = 10;
Reported by PMD.
Line: 41
@Test
public void withNonEmptyFlowable() {
assertTrue(Flowable.just(1, 2, 3).ignoreElements().toFlowable().isEmpty().blockingGet());
}
@Test
public void upstreamIsProcessedButIgnoredFlowable() {
final int num = 10;
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithSingleTest.java
85 issues
Line: 33
import io.reactivex.rxjava3.subjects.*;
import io.reactivex.rxjava3.testsupport.TestHelper;
public class ObservableMergeWithSingleTest extends RxJavaTest {
@Test
public void normal() {
Observable.range(1, 5)
.mergeWith(Single.just(100))
Reported by PMD.
Line: 36
public class ObservableMergeWithSingleTest extends RxJavaTest {
@Test
public void normal() {
Observable.range(1, 5)
.mergeWith(Single.just(100))
.test()
.assertResult(1, 2, 3, 4, 5, 100);
}
Reported by PMD.
Line: 37
@Test
public void normal() {
Observable.range(1, 5)
.mergeWith(Single.just(100))
.test()
.assertResult(1, 2, 3, 4, 5, 100);
}
Reported by PMD.
Line: 37
@Test
public void normal() {
Observable.range(1, 5)
.mergeWith(Single.just(100))
.test()
.assertResult(1, 2, 3, 4, 5, 100);
}
Reported by PMD.
Line: 37
@Test
public void normal() {
Observable.range(1, 5)
.mergeWith(Single.just(100))
.test()
.assertResult(1, 2, 3, 4, 5, 100);
}
Reported by PMD.
Line: 44
}
@Test
public void normalLong() {
Observable.range(1, 512)
.mergeWith(Single.just(100))
.test()
.assertValueCount(513)
.assertComplete();
Reported by PMD.
Line: 45
@Test
public void normalLong() {
Observable.range(1, 512)
.mergeWith(Single.just(100))
.test()
.assertValueCount(513)
.assertComplete();
}
Reported by PMD.
Line: 45
@Test
public void normalLong() {
Observable.range(1, 512)
.mergeWith(Single.just(100))
.test()
.assertValueCount(513)
.assertComplete();
}
Reported by PMD.
Line: 45
@Test
public void normalLong() {
Observable.range(1, 512)
.mergeWith(Single.just(100))
.test()
.assertValueCount(513)
.assertComplete();
}
Reported by PMD.
Line: 45
@Test
public void normalLong() {
Observable.range(1, 512)
.mergeWith(Single.just(100))
.test()
.assertValueCount(513)
.assertComplete();
}
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSequenceEqualTest.java
84 issues
Line: 29
import io.reactivex.rxjava3.subjects.PublishSubject;
import io.reactivex.rxjava3.testsupport.TestHelper;
public class ObservableSequenceEqualTest extends RxJavaTest {
@Test
public void observable1() {
Observable<Boolean> o = Observable.sequenceEqual(
Observable.just("one", "two", "three"),
Reported by PMD.
Line: 33
@Test
public void observable1() {
Observable<Boolean> o = Observable.sequenceEqual(
Observable.just("one", "two", "three"),
Observable.just("one", "two", "three")).toObservable();
verifyResult(o, true);
}
Reported by PMD.
Line: 34
@Test
public void observable1() {
Observable<Boolean> o = Observable.sequenceEqual(
Observable.just("one", "two", "three"),
Observable.just("one", "two", "three")).toObservable();
verifyResult(o, true);
}
@Test
Reported by PMD.
Line: 34
@Test
public void observable1() {
Observable<Boolean> o = Observable.sequenceEqual(
Observable.just("one", "two", "three"),
Observable.just("one", "two", "three")).toObservable();
verifyResult(o, true);
}
@Test
Reported by PMD.
Line: 34
@Test
public void observable1() {
Observable<Boolean> o = Observable.sequenceEqual(
Observable.just("one", "two", "three"),
Observable.just("one", "two", "three")).toObservable();
verifyResult(o, true);
}
@Test
Reported by PMD.
Line: 41
@Test
public void observable2() {
Observable<Boolean> o = Observable.sequenceEqual(
Observable.just("one", "two", "three"),
Observable.just("one", "two", "three", "four")).toObservable();
verifyResult(o, false);
}
Reported by PMD.
Line: 43
public void observable2() {
Observable<Boolean> o = Observable.sequenceEqual(
Observable.just("one", "two", "three"),
Observable.just("one", "two", "three", "four")).toObservable();
verifyResult(o, false);
}
@Test
public void observable3() {
Reported by PMD.
Line: 49
@Test
public void observable3() {
Observable<Boolean> o = Observable.sequenceEqual(
Observable.just("one", "two", "three", "four"),
Observable.just("one", "two", "three")).toObservable();
verifyResult(o, false);
}
Reported by PMD.
Line: 85
@Test
public void withEmpty1Observable() {
Observable<Boolean> o = Observable.sequenceEqual(
Observable.<String> empty(),
Observable.just("one", "two", "three")).toObservable();
verifyResult(o, false);
}
Reported by PMD.
Line: 93
@Test
public void withEmpty2Observable() {
Observable<Boolean> o = Observable.sequenceEqual(
Observable.just("one", "two", "three"),
Observable.<String> empty()).toObservable();
verifyResult(o, false);
}
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDistinctUntilChangedTest.java
83 issues
Line: 35
import io.reactivex.rxjava3.subjects.*;
import io.reactivex.rxjava3.testsupport.*;
public class ObservableDistinctUntilChangedTest extends RxJavaTest {
Observer<String> w;
Observer<String> w2;
// nulls lead to exceptions
Reported by PMD.
Line: 37
public class ObservableDistinctUntilChangedTest extends RxJavaTest {
Observer<String> w;
Observer<String> w2;
// nulls lead to exceptions
final Function<String, String> TO_UPPER_WITH_EXCEPTION = new Function<String, String>() {
@Override
Reported by PMD.
Line: 38
public class ObservableDistinctUntilChangedTest extends RxJavaTest {
Observer<String> w;
Observer<String> w2;
// nulls lead to exceptions
final Function<String, String> TO_UPPER_WITH_EXCEPTION = new Function<String, String>() {
@Override
public String apply(String s) {
Reported by PMD.
Line: 41
Observer<String> w2;
// nulls lead to exceptions
final Function<String, String> TO_UPPER_WITH_EXCEPTION = new Function<String, String>() {
@Override
public String apply(String s) {
if (s.equals("x")) {
return "xx";
}
Reported by PMD.
Line: 44
final Function<String, String> TO_UPPER_WITH_EXCEPTION = new Function<String, String>() {
@Override
public String apply(String s) {
if (s.equals("x")) {
return "xx";
}
return s.toUpperCase();
}
};
Reported by PMD.
Line: 44
final Function<String, String> TO_UPPER_WITH_EXCEPTION = new Function<String, String>() {
@Override
public String apply(String s) {
if (s.equals("x")) {
return "xx";
}
return s.toUpperCase();
}
};
Reported by PMD.
Line: 47
if (s.equals("x")) {
return "xx";
}
return s.toUpperCase();
}
};
@Before
public void before() {
Reported by PMD.
Line: 60
@Test
public void distinctUntilChangedOfNone() {
Observable<String> src = Observable.empty();
src.distinctUntilChanged().subscribe(w);
verify(w, never()).onNext(anyString());
verify(w, never()).onError(any(Throwable.class));
verify(w, times(1)).onComplete();
}
Reported by PMD.
Line: 60
@Test
public void distinctUntilChangedOfNone() {
Observable<String> src = Observable.empty();
src.distinctUntilChanged().subscribe(w);
verify(w, never()).onNext(anyString());
verify(w, never()).onError(any(Throwable.class));
verify(w, times(1)).onComplete();
}
Reported by PMD.
Line: 62
Observable<String> src = Observable.empty();
src.distinctUntilChanged().subscribe(w);
verify(w, never()).onNext(anyString());
verify(w, never()).onError(any(Throwable.class));
verify(w, times(1)).onComplete();
}
@Test
Reported by PMD.
src/test/java/io/reactivex/rxjava3/parallel/ParallelFilterTryTest.java
83 issues
Line: 27
import io.reactivex.rxjava3.plugins.RxJavaPlugins;
import io.reactivex.rxjava3.testsupport.*;
public class ParallelFilterTryTest extends RxJavaTest implements Consumer<Object> {
volatile int calls;
@Override
public void accept(Object t) throws Exception {
Reported by PMD.
Line: 29
public class ParallelFilterTryTest extends RxJavaTest implements Consumer<Object> {
volatile int calls;
@Override
public void accept(Object t) throws Exception {
calls++;
}
Reported by PMD.
Line: 37
}
@Test
public void filterNoError() {
for (ParallelFailureHandling e : ParallelFailureHandling.values()) {
Flowable.just(1)
.parallel(1)
.filter(Functions.alwaysTrue(), e)
.sequential()
Reported by PMD.
Line: 39
@Test
public void filterNoError() {
for (ParallelFailureHandling e : ParallelFailureHandling.values()) {
Flowable.just(1)
.parallel(1)
.filter(Functions.alwaysTrue(), e)
.sequential()
.test()
.assertResult(1);
Reported by PMD.
Line: 39
@Test
public void filterNoError() {
for (ParallelFailureHandling e : ParallelFailureHandling.values()) {
Flowable.just(1)
.parallel(1)
.filter(Functions.alwaysTrue(), e)
.sequential()
.test()
.assertResult(1);
Reported by PMD.
Line: 39
@Test
public void filterNoError() {
for (ParallelFailureHandling e : ParallelFailureHandling.values()) {
Flowable.just(1)
.parallel(1)
.filter(Functions.alwaysTrue(), e)
.sequential()
.test()
.assertResult(1);
Reported by PMD.
Line: 39
@Test
public void filterNoError() {
for (ParallelFailureHandling e : ParallelFailureHandling.values()) {
Flowable.just(1)
.parallel(1)
.filter(Functions.alwaysTrue(), e)
.sequential()
.test()
.assertResult(1);
Reported by PMD.
Line: 39
@Test
public void filterNoError() {
for (ParallelFailureHandling e : ParallelFailureHandling.values()) {
Flowable.just(1)
.parallel(1)
.filter(Functions.alwaysTrue(), e)
.sequential()
.test()
.assertResult(1);
Reported by PMD.
Line: 49
}
@Test
public void filterFalse() {
for (ParallelFailureHandling e : ParallelFailureHandling.values()) {
Flowable.just(1)
.parallel(1)
.filter(Functions.alwaysFalse(), e)
.sequential()
Reported by PMD.
Line: 51
@Test
public void filterFalse() {
for (ParallelFailureHandling e : ParallelFailureHandling.values()) {
Flowable.just(1)
.parallel(1)
.filter(Functions.alwaysFalse(), e)
.sequential()
.test()
.assertResult();
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnBackpressureBufferStrategyTest.java
83 issues
Line: 34
import io.reactivex.rxjava3.subscribers.*;
import io.reactivex.rxjava3.testsupport.TestHelper;
public class FlowableOnBackpressureBufferStrategyTest extends RxJavaTest {
@Test
public void backpressureWithBufferDropOldest() throws InterruptedException {
int bufferSize = 3;
final AtomicInteger droppedCount = new AtomicInteger(0);
Reported by PMD.
Line: 37
public class FlowableOnBackpressureBufferStrategyTest extends RxJavaTest {
@Test
public void backpressureWithBufferDropOldest() throws InterruptedException {
int bufferSize = 3;
final AtomicInteger droppedCount = new AtomicInteger(0);
Action incrementOnDrop = new Action() {
@Override
public void run() throws Exception {
Reported by PMD.
Line: 47
}
};
TestSubscriber<Long> ts = createTestSubscriber();
Flowable.fromPublisher(send500ValuesAndComplete.onBackpressureBuffer(bufferSize, incrementOnDrop, DROP_OLDEST))
.subscribe(ts);
// we request 10 but only 3 should come from the buffer
ts.request(10);
ts.awaitDone(5, TimeUnit.SECONDS);
assertEquals(bufferSize, ts.values().size());
Reported by PMD.
Line: 50
Flowable.fromPublisher(send500ValuesAndComplete.onBackpressureBuffer(bufferSize, incrementOnDrop, DROP_OLDEST))
.subscribe(ts);
// we request 10 but only 3 should come from the buffer
ts.request(10);
ts.awaitDone(5, TimeUnit.SECONDS);
assertEquals(bufferSize, ts.values().size());
ts.assertNoErrors();
assertEquals(497, ts.values().get(0).intValue());
assertEquals(498, ts.values().get(1).intValue());
Reported by PMD.
Line: 51
.subscribe(ts);
// we request 10 but only 3 should come from the buffer
ts.request(10);
ts.awaitDone(5, TimeUnit.SECONDS);
assertEquals(bufferSize, ts.values().size());
ts.assertNoErrors();
assertEquals(497, ts.values().get(0).intValue());
assertEquals(498, ts.values().get(1).intValue());
assertEquals(499, ts.values().get(2).intValue());
Reported by PMD.
Line: 52
// we request 10 but only 3 should come from the buffer
ts.request(10);
ts.awaitDone(5, TimeUnit.SECONDS);
assertEquals(bufferSize, ts.values().size());
ts.assertNoErrors();
assertEquals(497, ts.values().get(0).intValue());
assertEquals(498, ts.values().get(1).intValue());
assertEquals(499, ts.values().get(2).intValue());
assertEquals(droppedCount.get(), 500 - bufferSize);
Reported by PMD.
Line: 52
// we request 10 but only 3 should come from the buffer
ts.request(10);
ts.awaitDone(5, TimeUnit.SECONDS);
assertEquals(bufferSize, ts.values().size());
ts.assertNoErrors();
assertEquals(497, ts.values().get(0).intValue());
assertEquals(498, ts.values().get(1).intValue());
assertEquals(499, ts.values().get(2).intValue());
assertEquals(droppedCount.get(), 500 - bufferSize);
Reported by PMD.
Line: 52
// we request 10 but only 3 should come from the buffer
ts.request(10);
ts.awaitDone(5, TimeUnit.SECONDS);
assertEquals(bufferSize, ts.values().size());
ts.assertNoErrors();
assertEquals(497, ts.values().get(0).intValue());
assertEquals(498, ts.values().get(1).intValue());
assertEquals(499, ts.values().get(2).intValue());
assertEquals(droppedCount.get(), 500 - bufferSize);
Reported by PMD.
Line: 53
ts.request(10);
ts.awaitDone(5, TimeUnit.SECONDS);
assertEquals(bufferSize, ts.values().size());
ts.assertNoErrors();
assertEquals(497, ts.values().get(0).intValue());
assertEquals(498, ts.values().get(1).intValue());
assertEquals(499, ts.values().get(2).intValue());
assertEquals(droppedCount.get(), 500 - bufferSize);
}
Reported by PMD.
Line: 54
ts.awaitDone(5, TimeUnit.SECONDS);
assertEquals(bufferSize, ts.values().size());
ts.assertNoErrors();
assertEquals(497, ts.values().get(0).intValue());
assertEquals(498, ts.values().get(1).intValue());
assertEquals(499, ts.values().get(2).intValue());
assertEquals(droppedCount.get(), 500 - bufferSize);
}
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapIterableFlowableTest.java
82 issues
Line: 14
* the License for the specific language governing permissions and limitations under the License.
*/
package io.reactivex.rxjava3.internal.operators.maybe;
import static org.junit.Assert.*;
import java.util.*;
import java.util.concurrent.TimeUnit;
Reported by PMD.
Line: 34
import io.reactivex.rxjava3.subscribers.TestSubscriber;
import io.reactivex.rxjava3.testsupport.*;
public class MaybeFlatMapIterableFlowableTest extends RxJavaTest {
@Test
public void normal() {
Maybe.just(1).flattenAsFlowable(new Function<Integer, Iterable<Integer>>() {
Reported by PMD.
Line: 37
public class MaybeFlatMapIterableFlowableTest extends RxJavaTest {
@Test
public void normal() {
Maybe.just(1).flattenAsFlowable(new Function<Integer, Iterable<Integer>>() {
@Override
public Iterable<Integer> apply(Integer v) throws Exception {
return Arrays.asList(v, v + 1);
Reported by PMD.
Line: 50
}
@Test
public void emptyIterable() {
Maybe.just(1).flattenAsFlowable(new Function<Integer, Iterable<Integer>>() {
@Override
public Iterable<Integer> apply(Integer v) throws Exception {
return Collections.<Integer>emptyList();
Reported by PMD.
Line: 63
}
@Test
public void error() {
Maybe.<Integer>error(new TestException()).flattenAsFlowable(new Function<Integer, Iterable<Integer>>() {
@Override
public Iterable<Integer> apply(Integer v) throws Exception {
return Arrays.asList(v, v + 1);
Reported by PMD.
Line: 76
}
@Test
public void empty() {
Maybe.<Integer>empty().flattenAsFlowable(new Function<Integer, Iterable<Integer>>() {
@Override
public Iterable<Integer> apply(Integer v) throws Exception {
return Arrays.asList(v, v + 1);
Reported by PMD.
Line: 89
}
@Test
public void backpressure() {
TestSubscriber<Integer> ts = Maybe.just(1).flattenAsFlowable(new Function<Integer, Iterable<Integer>>() {
@Override
public Iterable<Integer> apply(Integer v) throws Exception {
return Arrays.asList(v, v + 1);
Reported by PMD.
Line: 111
}
@Test
public void take() {
Maybe.just(1).flattenAsFlowable(new Function<Integer, Iterable<Integer>>() {
@Override
public Iterable<Integer> apply(Integer v) throws Exception {
return Arrays.asList(v, v + 1);
}
Reported by PMD.
Line: 124
}
@Test
public void take2() {
Maybe.just(1).flattenAsFlowable(new Function<Integer, Iterable<Integer>>() {
@Override
public Iterable<Integer> apply(Integer v) throws Exception {
return Arrays.asList(v, v + 1);
}
Reported by PMD.
Line: 138
}
@Test
public void fused() {
TestSubscriberEx<Integer> ts = new TestSubscriberEx<Integer>().setInitialFusionMode(QueueFuseable.ANY);
Maybe.just(1).flattenAsFlowable(new Function<Integer, Iterable<Integer>>() {
@Override
public Iterable<Integer> apply(Integer v) throws Exception {
Reported by PMD.