The following issues were found

src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeCacheTest.java
113 issues
This class has too many methods, consider refactoring it.
Design

Line: 30

              import io.reactivex.rxjava3.subscribers.TestSubscriber;
import io.reactivex.rxjava3.testsupport.TestHelper;

public class MaybeCacheTest extends RxJavaTest {

    @Test
    public void offlineSuccess() {
        Maybe<Integer> source = Maybe.just(1).cache();
        assertEquals(1, source.blockingGet().intValue());

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 34

              
    @Test
    public void offlineSuccess() {
        Maybe<Integer> source = Maybe.just(1).cache();
        assertEquals(1, source.blockingGet().intValue());

        source.test()
        .assertResult(1);
    }

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 35

                  @Test
    public void offlineSuccess() {
        Maybe<Integer> source = Maybe.just(1).cache();
        assertEquals(1, source.blockingGet().intValue());

        source.test()
        .assertResult(1);
    }


            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 35

                  @Test
    public void offlineSuccess() {
        Maybe<Integer> source = Maybe.just(1).cache();
        assertEquals(1, source.blockingGet().intValue());

        source.test()
        .assertResult(1);
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 35

                  @Test
    public void offlineSuccess() {
        Maybe<Integer> source = Maybe.just(1).cache();
        assertEquals(1, source.blockingGet().intValue());

        source.test()
        .assertResult(1);
    }


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 37

                      Maybe<Integer> source = Maybe.just(1).cache();
        assertEquals(1, source.blockingGet().intValue());

        source.test()
        .assertResult(1);
    }

    @Test
    public void offlineError() {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 37

                      Maybe<Integer> source = Maybe.just(1).cache();
        assertEquals(1, source.blockingGet().intValue());

        source.test()
        .assertResult(1);
    }

    @Test
    public void offlineError() {

            

Reported by PMD.

In JUnit4, use the @Test(expected) annotation to denote tests that should throw exceptions
Design

Line: 47

              
        try {
            source.blockingGet();
            fail("Should have thrown");
        } catch (TestException ex) {
            // expected
        }

        source.test()

            

Reported by PMD.

Avoid empty catch blocks
Error

Line: 48

                      try {
            source.blockingGet();
            fail("Should have thrown");
        } catch (TestException ex) {
            // expected
        }

        source.test()
        .assertFailure(TestException.class);

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 52

                          // expected
        }

        source.test()
        .assertFailure(TestException.class);
    }

    @Test
    public void offlineComplete() {

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableRepeatTest.java
113 issues
System.out.println is used
Design

Line: 186

                      .concatMap(new Function<Integer, Observable<Integer>>() {
            @Override
            public Observable<Integer> apply(Integer x) {
                System.out.println("testRepeatRetarget -> " + x);
                concatBase.add(x);
                return Observable.<Integer>empty()
                        .delay(200, TimeUnit.MILLISECONDS);
            }
        })

            

Reported by PMD.

This class has a bunch of public methods and attributes
Design

Line: 14

               * the License for the specific language governing permissions and limitations under the License.
 */

package io.reactivex.rxjava3.internal.operators.observable;

import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;


            

Reported by PMD.

This class has too many methods, consider refactoring it.
Design

Line: 38

              import io.reactivex.rxjava3.subjects.PublishSubject;
import io.reactivex.rxjava3.testsupport.*;

public class ObservableRepeatTest extends RxJavaTest {

    @Test
    public void repetition() {
        int num = 10;
        final AtomicInteger count = new AtomicInteger();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 54

                      }).repeat().subscribeOn(Schedulers.computation())
        .take(num).blockingLast();

        assertEquals(num, value);
    }

    @Test
    public void repeatTake() {
        Observable<Integer> xs = Observable.just(1, 2);

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 60

                  @Test
    public void repeatTake() {
        Observable<Integer> xs = Observable.just(1, 2);
        Object[] ys = xs.repeat().subscribeOn(Schedulers.newThread()).take(4).toList().blockingGet().toArray();
        assertArrayEquals(new Object[] { 1, 2, 1, 2 }, ys);
    }

    @Test
    public void noStackOverFlow() {

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 60

                  @Test
    public void repeatTake() {
        Observable<Integer> xs = Observable.just(1, 2);
        Object[] ys = xs.repeat().subscribeOn(Schedulers.newThread()).take(4).toList().blockingGet().toArray();
        assertArrayEquals(new Object[] { 1, 2, 1, 2 }, ys);
    }

    @Test
    public void noStackOverFlow() {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 60

                  @Test
    public void repeatTake() {
        Observable<Integer> xs = Observable.just(1, 2);
        Object[] ys = xs.repeat().subscribeOn(Schedulers.newThread()).take(4).toList().blockingGet().toArray();
        assertArrayEquals(new Object[] { 1, 2, 1, 2 }, ys);
    }

    @Test
    public void noStackOverFlow() {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 60

                  @Test
    public void repeatTake() {
        Observable<Integer> xs = Observable.just(1, 2);
        Object[] ys = xs.repeat().subscribeOn(Schedulers.newThread()).take(4).toList().blockingGet().toArray();
        assertArrayEquals(new Object[] { 1, 2, 1, 2 }, ys);
    }

    @Test
    public void noStackOverFlow() {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 60

                  @Test
    public void repeatTake() {
        Observable<Integer> xs = Observable.just(1, 2);
        Object[] ys = xs.repeat().subscribeOn(Schedulers.newThread()).take(4).toList().blockingGet().toArray();
        assertArrayEquals(new Object[] { 1, 2, 1, 2 }, ys);
    }

    @Test
    public void noStackOverFlow() {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 60

                  @Test
    public void repeatTake() {
        Observable<Integer> xs = Observable.just(1, 2);
        Object[] ys = xs.repeat().subscribeOn(Schedulers.newThread()).take(4).toList().blockingGet().toArray();
        assertArrayEquals(new Object[] { 1, 2, 1, 2 }, ys);
    }

    @Test
    public void noStackOverFlow() {

            

Reported by PMD.

src/jmh/java/io/reactivex/rxjava3/core/BinaryFlatMapPerf.java
113 issues
The class 'BinaryFlatMapPerf' has a Modified Cyclomatic Complexity of 2 (Highest = 13).
Design

Line: 31

              @OutputTimeUnit(TimeUnit.SECONDS)
@Fork(value = 1)
@State(Scope.Thread)
public class BinaryFlatMapPerf {
    @Param({ "1", "1000", "1000000" })
    public int times;

    Flowable<Integer> singleFlatMapPublisher;


            

Reported by PMD.

Too many fields
Design

Line: 31

              @OutputTimeUnit(TimeUnit.SECONDS)
@Fork(value = 1)
@State(Scope.Thread)
public class BinaryFlatMapPerf {
    @Param({ "1", "1000", "1000000" })
    public int times;

    Flowable<Integer> singleFlatMapPublisher;


            

Reported by PMD.

This class has too many methods, consider refactoring it.
Design

Line: 31

              @OutputTimeUnit(TimeUnit.SECONDS)
@Fork(value = 1)
@State(Scope.Thread)
public class BinaryFlatMapPerf {
    @Param({ "1", "1000", "1000000" })
    public int times;

    Flowable<Integer> singleFlatMapPublisher;


            

Reported by PMD.

The class 'BinaryFlatMapPerf' is suspected to be a Data Class (WOC=5.882%, NOPA=1, NOAM=16, WMC=17)
Design

Line: 31

              @OutputTimeUnit(TimeUnit.SECONDS)
@Fork(value = 1)
@State(Scope.Thread)
public class BinaryFlatMapPerf {
    @Param({ "1", "1000", "1000000" })
    public int times;

    Flowable<Integer> singleFlatMapPublisher;


            

Reported by PMD.

The class 'BinaryFlatMapPerf' has a Standard Cyclomatic Complexity of 2 (Highest = 13).
Design

Line: 31

              @OutputTimeUnit(TimeUnit.SECONDS)
@Fork(value = 1)
@State(Scope.Thread)
public class BinaryFlatMapPerf {
    @Param({ "1", "1000", "1000000" })
    public int times;

    Flowable<Integer> singleFlatMapPublisher;


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 33

              @State(Scope.Thread)
public class BinaryFlatMapPerf {
    @Param({ "1", "1000", "1000000" })
    public int times;

    Flowable<Integer> singleFlatMapPublisher;

    Flowable<Integer> singleFlatMapHidePublisher;


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 35

                  @Param({ "1", "1000", "1000000" })
    public int times;

    Flowable<Integer> singleFlatMapPublisher;

    Flowable<Integer> singleFlatMapHidePublisher;

    Flowable<Integer> singleFlattenAsPublisher;


            

Reported by PMD.

Field singleFlatMapPublisher has the same name as a method
Error

Line: 35

                  @Param({ "1", "1000", "1000000" })
    public int times;

    Flowable<Integer> singleFlatMapPublisher;

    Flowable<Integer> singleFlatMapHidePublisher;

    Flowable<Integer> singleFlattenAsPublisher;


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 37

              
    Flowable<Integer> singleFlatMapPublisher;

    Flowable<Integer> singleFlatMapHidePublisher;

    Flowable<Integer> singleFlattenAsPublisher;

    Flowable<Integer> maybeFlatMapPublisher;


            

Reported by PMD.

Field singleFlatMapHidePublisher has the same name as a method
Error

Line: 37

              
    Flowable<Integer> singleFlatMapPublisher;

    Flowable<Integer> singleFlatMapHidePublisher;

    Flowable<Integer> singleFlattenAsPublisher;

    Flowable<Integer> maybeFlatMapPublisher;


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/subscribers/DeferredScalarSubscriberTest.java
112 issues
This class has too many methods, consider refactoring it.
Design

Line: 35

              import io.reactivex.rxjava3.subscribers.TestSubscriber;
import io.reactivex.rxjava3.testsupport.TestHelper;

public class DeferredScalarSubscriberTest extends RxJavaTest {

    @Test
    public void completeFirst() {
        TestSubscriber<Integer> ts = TestSubscriber.create(0L);
        TestingDeferredScalarSubscriber ds = new TestingDeferredScalarSubscriber(ts);

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 38

              public class DeferredScalarSubscriberTest extends RxJavaTest {

    @Test
    public void completeFirst() {
        TestSubscriber<Integer> ts = TestSubscriber.create(0L);
        TestingDeferredScalarSubscriber ds = new TestingDeferredScalarSubscriber(ts);
        ds.setupDownstream();

        ds.onNext(1);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 45

              
        ds.onNext(1);

        ts.assertNoValues();

        ds.onComplete();

        ts.assertNoValues();


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 49

              
        ds.onComplete();

        ts.assertNoValues();

        ts.request(1);

        ts.assertValues(1);
        ts.assertNoErrors();

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 51

              
        ts.assertNoValues();

        ts.request(1);

        ts.assertValues(1);
        ts.assertNoErrors();
        ts.assertComplete();
    }

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 53

              
        ts.request(1);

        ts.assertValues(1);
        ts.assertNoErrors();
        ts.assertComplete();
    }

    @Test

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 54

                      ts.request(1);

        ts.assertValues(1);
        ts.assertNoErrors();
        ts.assertComplete();
    }

    @Test
    public void requestFirst() {

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 55

              
        ts.assertValues(1);
        ts.assertNoErrors();
        ts.assertComplete();
    }

    @Test
    public void requestFirst() {
        TestSubscriber<Integer> ts = TestSubscriber.create(1);

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 59

                  }

    @Test
    public void requestFirst() {
        TestSubscriber<Integer> ts = TestSubscriber.create(1);
        TestingDeferredScalarSubscriber ds = new TestingDeferredScalarSubscriber(ts);
        ds.setupDownstream();

        ds.onNext(1);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 66

              
        ds.onNext(1);

        ts.assertNoValues();

        ds.onComplete();

        ts.assertValues(1);
        ts.assertNoErrors();

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTakeLastTimedTest.java
112 issues
This class has too many methods, consider refactoring it.
Design

Line: 31

              import io.reactivex.rxjava3.subjects.PublishSubject;
import io.reactivex.rxjava3.testsupport.*;

public class ObservableTakeLastTimedTest extends RxJavaTest {

    @Test(expected = IllegalArgumentException.class)
    public void takeLastTimedWithNegativeCount() {
        Observable.just("one").takeLast(-1, 1, TimeUnit.SECONDS);
    }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 35

              
    @Test(expected = IllegalArgumentException.class)
    public void takeLastTimedWithNegativeCount() {
        Observable.just("one").takeLast(-1, 1, TimeUnit.SECONDS);
    }

    @Test
    public void takeLastTimed() {
        TestScheduler scheduler = new TestScheduler();

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 45

                      PublishSubject<Object> source = PublishSubject.create();

        // FIXME time unit now matters!
        Observable<Object> result = source.takeLast(1000, TimeUnit.MILLISECONDS, scheduler);

        Observer<Object> o = TestHelper.mockObserver();

        InOrder inOrder = inOrder(o);


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 51

              
        InOrder inOrder = inOrder(o);

        result.subscribe(o);

        source.onNext(1); // T: 0ms
        scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);
        source.onNext(2); // T: 250ms
        scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 53

              
        result.subscribe(o);

        source.onNext(1); // T: 0ms
        scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);
        source.onNext(2); // T: 250ms
        scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);
        source.onNext(3); // T: 500ms
        scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 55

              
        source.onNext(1); // T: 0ms
        scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);
        source.onNext(2); // T: 250ms
        scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);
        source.onNext(3); // T: 500ms
        scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);
        source.onNext(4); // T: 750ms
        scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 57

                      scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);
        source.onNext(2); // T: 250ms
        scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);
        source.onNext(3); // T: 500ms
        scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);
        source.onNext(4); // T: 750ms
        scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);
        source.onNext(5); // T: 1000ms
        scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 59

                      scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);
        source.onNext(3); // T: 500ms
        scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);
        source.onNext(4); // T: 750ms
        scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);
        source.onNext(5); // T: 1000ms
        scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);
        source.onComplete(); // T: 1250ms


            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 61

                      scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);
        source.onNext(4); // T: 750ms
        scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);
        source.onNext(5); // T: 1000ms
        scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);
        source.onComplete(); // T: 1250ms

        inOrder.verify(o, times(1)).onNext(2);
        inOrder.verify(o, times(1)).onNext(3);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 63

                      scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);
        source.onNext(5); // T: 1000ms
        scheduler.advanceTimeBy(250, TimeUnit.MILLISECONDS);
        source.onComplete(); // T: 1250ms

        inOrder.verify(o, times(1)).onNext(2);
        inOrder.verify(o, times(1)).onNext(3);
        inOrder.verify(o, times(1)).onNext(4);
        inOrder.verify(o, times(1)).onNext(5);

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapSingleTest.java
111 issues
This class has a bunch of public methods and attributes
Design

Line: 14

               * the License for the specific language governing permissions and limitations under the License.
 */

package io.reactivex.rxjava3.internal.operators.flowable;

import static org.junit.Assert.*;

import java.util.List;
import java.util.concurrent.*;

            

Reported by PMD.

This class has too many methods, consider refactoring it.
Design

Line: 37

              import io.reactivex.rxjava3.subscribers.TestSubscriber;
import io.reactivex.rxjava3.testsupport.*;

public class FlowableFlatMapSingleTest extends RxJavaTest {

    @Test
    public void normal() {
        Flowable.range(1, 10)
        .flatMapSingle(new Function<Integer, SingleSource<Integer>>() {

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 40

              public class FlowableFlatMapSingleTest extends RxJavaTest {

    @Test
    public void normal() {
        Flowable.range(1, 10)
        .flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override
            public SingleSource<Integer> apply(Integer v) throws Exception {
                return Single.just(v);

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 53

                  }

    @Test
    public void normalDelayError() {
        Flowable.range(1, 10)
        .flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override
            public SingleSource<Integer> apply(Integer v) throws Exception {
                return Single.just(v);

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 66

                  }

    @Test
    public void normalAsync() {
        TestSubscriberEx<Integer> ts = Flowable.range(1, 10)
        .flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override
            public SingleSource<Integer> apply(Integer v) throws Exception {
                return Single.just(v).subscribeOn(Schedulers.computation());

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 71

                      .flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override
            public SingleSource<Integer> apply(Integer v) throws Exception {
                return Single.just(v).subscribeOn(Schedulers.computation());
            }
        })
        .to(TestHelper.<Integer>testConsumer())
        .awaitDone(5, TimeUnit.SECONDS)
        .assertSubscribed()

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 85

                  }

    @Test
    public void normalAsyncMaxConcurrency() {
        TestSubscriberEx<Integer> ts = Flowable.range(1, 10)
        .flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override
            public SingleSource<Integer> apply(Integer v) throws Exception {
                return Single.just(v).subscribeOn(Schedulers.computation());

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 90

                      .flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override
            public SingleSource<Integer> apply(Integer v) throws Exception {
                return Single.just(v).subscribeOn(Schedulers.computation());
            }
        }, false, 3)
        .to(TestHelper.<Integer>testConsumer())
        .awaitDone(5, TimeUnit.SECONDS)
        .assertSubscribed()

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 103

                   }

    @Test
    public void normalAsyncMaxConcurrency1() {
        Flowable.range(1, 10)
        .flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override
            public SingleSource<Integer> apply(Integer v) throws Exception {
                return Single.just(v).subscribeOn(Schedulers.computation());

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 108

                      .flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override
            public SingleSource<Integer> apply(Integer v) throws Exception {
                return Single.just(v).subscribeOn(Schedulers.computation());
            }
        }, false, 1)
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableElementAtTest.java
109 issues
This class has too many methods, consider refactoring it.
Design

Line: 34

              import io.reactivex.rxjava3.processors.PublishProcessor;
import io.reactivex.rxjava3.testsupport.TestHelper;

public class FlowableElementAtTest extends RxJavaTest {

    @Test
    public void elementAtFlowable() {
        assertEquals(2, Flowable.fromArray(1, 2).elementAt(1).toFlowable().blockingSingle()
                .intValue());

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 38

              
    @Test
    public void elementAtFlowable() {
        assertEquals(2, Flowable.fromArray(1, 2).elementAt(1).toFlowable().blockingSingle()
                .intValue());
    }

    @Test(expected = IndexOutOfBoundsException.class)
    public void elementAtWithMinusIndexFlowable() {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 38

              
    @Test
    public void elementAtFlowable() {
        assertEquals(2, Flowable.fromArray(1, 2).elementAt(1).toFlowable().blockingSingle()
                .intValue());
    }

    @Test(expected = IndexOutOfBoundsException.class)
    public void elementAtWithMinusIndexFlowable() {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 38

              
    @Test
    public void elementAtFlowable() {
        assertEquals(2, Flowable.fromArray(1, 2).elementAt(1).toFlowable().blockingSingle()
                .intValue());
    }

    @Test(expected = IndexOutOfBoundsException.class)
    public void elementAtWithMinusIndexFlowable() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 38

              
    @Test
    public void elementAtFlowable() {
        assertEquals(2, Flowable.fromArray(1, 2).elementAt(1).toFlowable().blockingSingle()
                .intValue());
    }

    @Test(expected = IndexOutOfBoundsException.class)
    public void elementAtWithMinusIndexFlowable() {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 38

              
    @Test
    public void elementAtFlowable() {
        assertEquals(2, Flowable.fromArray(1, 2).elementAt(1).toFlowable().blockingSingle()
                .intValue());
    }

    @Test(expected = IndexOutOfBoundsException.class)
    public void elementAtWithMinusIndexFlowable() {

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 44

              
    @Test(expected = IndexOutOfBoundsException.class)
    public void elementAtWithMinusIndexFlowable() {
        Flowable.fromArray(1, 2).elementAt(-1);
    }

    @Test
    public void elementAtWithIndexOutOfBoundsFlowable() {
        assertEquals(-100, Flowable.fromArray(1, 2).elementAt(2).toFlowable().blockingFirst(-100).intValue());

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 49

              
    @Test
    public void elementAtWithIndexOutOfBoundsFlowable() {
        assertEquals(-100, Flowable.fromArray(1, 2).elementAt(2).toFlowable().blockingFirst(-100).intValue());
    }

    @Test
    public void elementAtOrDefaultFlowable() {
        assertEquals(2, Flowable.fromArray(1, 2).elementAt(1, 0).toFlowable().blockingSingle().intValue());

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 49

              
    @Test
    public void elementAtWithIndexOutOfBoundsFlowable() {
        assertEquals(-100, Flowable.fromArray(1, 2).elementAt(2).toFlowable().blockingFirst(-100).intValue());
    }

    @Test
    public void elementAtOrDefaultFlowable() {
        assertEquals(2, Flowable.fromArray(1, 2).elementAt(1, 0).toFlowable().blockingSingle().intValue());

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 49

              
    @Test
    public void elementAtWithIndexOutOfBoundsFlowable() {
        assertEquals(-100, Flowable.fromArray(1, 2).elementAt(2).toFlowable().blockingFirst(-100).intValue());
    }

    @Test
    public void elementAtOrDefaultFlowable() {
        assertEquals(2, Flowable.fromArray(1, 2).elementAt(1, 0).toFlowable().blockingSingle().intValue());

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/validators/ParamValidationCheckerTest.java
108 issues
System.out.println is used
Design

Line: 768

                              if (ignoreList != null) {
                    for (ParamIgnore e : ignoreList) {
                        if (Arrays.equals(e.arguments, m.getParameterTypes())) {
                            System.out.println("CheckClass - ignore: " + m);
                            continue outer;
                        }
                    }
                }


            

Reported by PMD.

High amount of different objects as members denotes a high coupling
Design

Line: 14

               * the License for the specific language governing permissions and limitations under the License.
 */

package io.reactivex.rxjava3.validators;

import java.lang.reflect.*;
import java.time.Duration;
import java.util.*;
import java.util.concurrent.*;

            

Reported by PMD.

This class has a bunch of public methods and attributes
Design

Line: 14

               * the License for the specific language governing permissions and limitations under the License.
 */

package io.reactivex.rxjava3.validators;

import java.lang.reflect.*;
import java.time.Duration;
import java.util.*;
import java.util.concurrent.*;

            

Reported by PMD.

This class has too many methods, consider refactoring it.
Design

Line: 41

               * Check that static and instance methods validate their parameters against
 * null and invalid values properly.
 */
public class ParamValidationCheckerTest {

    @Test(timeout = 30000)
    public void checkFlowable() {
        checkClass(Flowable.class);
    }

            

Reported by PMD.

Avoid really long classes.
Design

Line: 41

               * Check that static and instance methods validate their parameters against
 * null and invalid values properly.
 */
public class ParamValidationCheckerTest {

    @Test(timeout = 30000)
    public void checkFlowable() {
        checkClass(Flowable.class);
    }

            

Reported by PMD.

Possible God Class (WMC=60, ATFD=57, TCC=4.545%)
Design

Line: 41

               * Check that static and instance methods validate their parameters against
 * null and invalid values properly.
 */
public class ParamValidationCheckerTest {

    @Test(timeout = 30000)
    public void checkFlowable() {
        checkClass(Flowable.class);
    }

            

Reported by PMD.

The class 'ParamValidationCheckerTest' has a Modified Cyclomatic Complexity of 5 (Highest = 34).
Design

Line: 41

               * Check that static and instance methods validate their parameters against
 * null and invalid values properly.
 */
public class ParamValidationCheckerTest {

    @Test(timeout = 30000)
    public void checkFlowable() {
        checkClass(Flowable.class);
    }

            

Reported by PMD.

The class 'ParamValidationCheckerTest' has a Standard Cyclomatic Complexity of 5 (Highest = 34).
Design

Line: 41

               * Check that static and instance methods validate their parameters against
 * null and invalid values properly.
 */
public class ParamValidationCheckerTest {

    @Test(timeout = 30000)
    public void checkFlowable() {
        checkClass(Flowable.class);
    }

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 44

              public class ParamValidationCheckerTest {

    @Test(timeout = 30000)
    public void checkFlowable() {
        checkClass(Flowable.class);
    }

    @Test(timeout = 30000)
    public void checkObservable() {

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 49

                  }

    @Test(timeout = 30000)
    public void checkObservable() {
        checkClass(Observable.class);
    }

    @Test(timeout = 30000)
    public void checkSingle() {

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/subscribers/BoundedSubscriberTest.java
106 issues
This class has a bunch of public methods and attributes
Design

Line: 14

               * the License for the specific language governing permissions and limitations under the License.
 */

package io.reactivex.rxjava3.internal.subscribers;

import static org.junit.Assert.*;

import java.util.*;


            

Reported by PMD.

This class has too many methods, consider refactoring it.
Design

Line: 32

              import io.reactivex.rxjava3.processors.PublishProcessor;
import io.reactivex.rxjava3.testsupport.*;

public class BoundedSubscriberTest extends RxJavaTest {

    @Test
    public void onSubscribeThrows() {
        final List<Object> received = new ArrayList<>();


            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 35

              public class BoundedSubscriberTest extends RxJavaTest {

    @Test
    public void onSubscribeThrows() {
        final List<Object> received = new ArrayList<>();

        BoundedSubscriber<Object> subscriber = new BoundedSubscriber<>(new Consumer<Object>() {
            @Override
            public void accept(Object o) throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 60

                          }
        }, 128);

        assertFalse(subscriber.isDisposed());

        Flowable.just(1).subscribe(subscriber);

        assertTrue(received.toString(), received.get(0) instanceof TestException);
        assertEquals(received.toString(), 1, received.size());

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 62

              
        assertFalse(subscriber.isDisposed());

        Flowable.just(1).subscribe(subscriber);

        assertTrue(received.toString(), received.get(0) instanceof TestException);
        assertEquals(received.toString(), 1, received.size());

        assertTrue(subscriber.isDisposed());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 65

                      Flowable.just(1).subscribe(subscriber);

        assertTrue(received.toString(), received.get(0) instanceof TestException);
        assertEquals(received.toString(), 1, received.size());

        assertTrue(subscriber.isDisposed());
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 67

                      assertTrue(received.toString(), received.get(0) instanceof TestException);
        assertEquals(received.toString(), 1, received.size());

        assertTrue(subscriber.isDisposed());
    }

    @Test
    public void onNextThrows() {
        final List<Object> received = new ArrayList<>();

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 71

                  }

    @Test
    public void onNextThrows() {
        final List<Object> received = new ArrayList<>();

        BoundedSubscriber<Object> subscriber = new BoundedSubscriber<>(new Consumer<Object>() {
            @Override
            public void accept(Object o) throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 96

                          }
        }, 128);

        assertFalse(subscriber.isDisposed());

        Flowable.just(1).subscribe(subscriber);

        assertTrue(received.toString(), received.get(0) instanceof TestException);
        assertEquals(received.toString(), 1, received.size());

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 98

              
        assertFalse(subscriber.isDisposed());

        Flowable.just(1).subscribe(subscriber);

        assertTrue(received.toString(), received.get(0) instanceof TestException);
        assertEquals(received.toString(), 1, received.size());

        assertTrue(subscriber.isDisposed());

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCacheTest.java
106 issues
System.out.println is used
Design

Line: 73

                                  @Override
                    public void run() {
                        counter.incrementAndGet();
                        System.out.println("published Observable being executed");
                        observer.onNext("one");
                        observer.onComplete();
                    }
                }).start();
            }

            

Reported by PMD.

System.out.println is used
Design

Line: 89

                          @Override
            public void accept(String v) {
                    assertEquals("one", v);
                    System.out.println("v: " + v);
                    latch.countDown();
            }
        });

        // subscribe again

            

Reported by PMD.

System.out.println is used
Design

Line: 99

                          @Override
            public void accept(String v) {
                    assertEquals("one", v);
                    System.out.println("v: " + v);
                    latch.countDown();
            }
        });

        if (!latch.await(1000, TimeUnit.MILLISECONDS)) {

            

Reported by PMD.

This class has too many methods, consider refactoring it.
Design

Line: 36

              import io.reactivex.rxjava3.subjects.PublishSubject;
import io.reactivex.rxjava3.testsupport.*;

public class ObservableCacheTest extends RxJavaTest {
    @Test
    public void coldReplayNoBackpressure() {
        ObservableCache<Integer> source = new ObservableCache<>(Observable.range(0, 1000), 16);

        assertFalse("Source is connected!", source.isConnected());

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 38

              
public class ObservableCacheTest extends RxJavaTest {
    @Test
    public void coldReplayNoBackpressure() {
        ObservableCache<Integer> source = new ObservableCache<>(Observable.range(0, 1000), 16);

        assertFalse("Source is connected!", source.isConnected());

        TestObserverEx<Integer> to = new TestObserverEx<>();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 53

                      to.assertNoErrors();
        to.assertTerminated();
        List<Integer> onNextEvents = to.values();
        assertEquals(1000, onNextEvents.size());

        for (int i = 0; i < 1000; i++) {
            assertEquals((Integer)i, onNextEvents.get(i));
        }
    }

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 53

                      to.assertNoErrors();
        to.assertTerminated();
        List<Integer> onNextEvents = to.values();
        assertEquals(1000, onNextEvents.size());

        for (int i = 0; i < 1000; i++) {
            assertEquals((Integer)i, onNextEvents.get(i));
        }
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 56

                      assertEquals(1000, onNextEvents.size());

        for (int i = 0; i < 1000; i++) {
            assertEquals((Integer)i, onNextEvents.get(i));
        }
    }

    @Test
    public void cache() throws InterruptedException {

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 61

                  }

    @Test
    public void cache() throws InterruptedException {
        final AtomicInteger counter = new AtomicInteger();
        Observable<String> o = Observable.unsafeCreate(new ObservableSource<String>() {

            @Override
            public void subscribe(final Observer<? super String> observer) {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 88

                      o.subscribe(new Consumer<String>() {
            @Override
            public void accept(String v) {
                    assertEquals("one", v);
                    System.out.println("v: " + v);
                    latch.countDown();
            }
        });


            

Reported by PMD.