The following issues were found

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

Line: 31

              import io.reactivex.rxjava3.plugins.RxJavaPlugins;
import io.reactivex.rxjava3.testsupport.TestHelper;

public final class ObservableCollectTest extends RxJavaTest {

    @Test
    public void collectToListObservable() {
        Observable<List<Integer>> o = Observable.just(1, 2, 3)
        .collect(new Supplier<List<Integer>>() {

            

Reported by PMD.

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

Line: 34

              public final class ObservableCollectTest extends RxJavaTest {

    @Test
    public void collectToListObservable() {
        Observable<List<Integer>> o = Observable.just(1, 2, 3)
        .collect(new Supplier<List<Integer>>() {
            @Override
            public List<Integer> get() {
                return new ArrayList<>();

            

Reported by PMD.

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

Line: 50

              
        List<Integer> list =  o.blockingLast();

        assertEquals(3, list.size());
        assertEquals(1, list.get(0).intValue());
        assertEquals(2, list.get(1).intValue());
        assertEquals(3, list.get(2).intValue());

        // test multiple subscribe

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 50

              
        List<Integer> list =  o.blockingLast();

        assertEquals(3, list.size());
        assertEquals(1, list.get(0).intValue());
        assertEquals(2, list.get(1).intValue());
        assertEquals(3, list.get(2).intValue());

        // test multiple subscribe

            

Reported by PMD.

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

Line: 51

                      List<Integer> list =  o.blockingLast();

        assertEquals(3, list.size());
        assertEquals(1, list.get(0).intValue());
        assertEquals(2, list.get(1).intValue());
        assertEquals(3, list.get(2).intValue());

        // test multiple subscribe
        List<Integer> list2 =  o.blockingLast();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 51

                      List<Integer> list =  o.blockingLast();

        assertEquals(3, list.size());
        assertEquals(1, list.get(0).intValue());
        assertEquals(2, list.get(1).intValue());
        assertEquals(3, list.get(2).intValue());

        // test multiple subscribe
        List<Integer> list2 =  o.blockingLast();

            

Reported by PMD.

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

Line: 51

                      List<Integer> list =  o.blockingLast();

        assertEquals(3, list.size());
        assertEquals(1, list.get(0).intValue());
        assertEquals(2, list.get(1).intValue());
        assertEquals(3, list.get(2).intValue());

        // test multiple subscribe
        List<Integer> list2 =  o.blockingLast();

            

Reported by PMD.

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

Line: 52

              
        assertEquals(3, list.size());
        assertEquals(1, list.get(0).intValue());
        assertEquals(2, list.get(1).intValue());
        assertEquals(3, list.get(2).intValue());

        // test multiple subscribe
        List<Integer> list2 =  o.blockingLast();


            

Reported by PMD.

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

Line: 52

              
        assertEquals(3, list.size());
        assertEquals(1, list.get(0).intValue());
        assertEquals(2, list.get(1).intValue());
        assertEquals(3, list.get(2).intValue());

        // test multiple subscribe
        List<Integer> list2 =  o.blockingLast();


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 52

              
        assertEquals(3, list.size());
        assertEquals(1, list.get(0).intValue());
        assertEquals(2, list.get(1).intValue());
        assertEquals(3, list.get(2).intValue());

        // test multiple subscribe
        List<Integer> list2 =  o.blockingLast();


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableUsingTest.java
129 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 static org.mockito.Mockito.*;

import java.util.*;

            

Reported by PMD.

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

Line: 36

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

public class FlowableUsingTest extends RxJavaTest {

    private interface Resource {
        String getTextFromWeb();

        void dispose();

            

Reported by PMD.

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

Line: 53

              
    }

    private final Consumer<Disposable> disposeSubscription = new Consumer<Disposable>() {

        @Override
        public void accept(Disposable d) {
            d.dispose();
        }

            

Reported by PMD.

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

Line: 74

              
    private void performTestUsing(boolean disposeEagerly) {
        final Resource resource = mock(Resource.class);
        when(resource.getTextFromWeb()).thenReturn("Hello world!");

        Supplier<Resource> resourceFactory = new Supplier<Resource>() {
            @Override
            public Resource get() {
                return resource;

            

Reported by PMD.

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

Line: 74

              
    private void performTestUsing(boolean disposeEagerly) {
        final Resource resource = mock(Resource.class);
        when(resource.getTextFromWeb()).thenReturn("Hello world!");

        Supplier<Resource> resourceFactory = new Supplier<Resource>() {
            @Override
            public Resource get() {
                return resource;

            

Reported by PMD.

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

Line: 86

                      Function<Resource, Flowable<String>> observableFactory = new Function<Resource, Flowable<String>>() {
            @Override
            public Flowable<String> apply(Resource res) {
                return Flowable.fromArray(res.getTextFromWeb().split(" "));
            }
        };

        Subscriber<String> subscriber = TestHelper.mockSubscriber();


            

Reported by PMD.

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

Line: 97

                      flowable.subscribe(subscriber);

        InOrder inOrder = inOrder(subscriber);
        inOrder.verify(subscriber, times(1)).onNext("Hello");
        inOrder.verify(subscriber, times(1)).onNext("world!");
        inOrder.verify(subscriber, times(1)).onComplete();
        inOrder.verifyNoMoreInteractions();

        // The resouce should be closed

            

Reported by PMD.

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

Line: 97

                      flowable.subscribe(subscriber);

        InOrder inOrder = inOrder(subscriber);
        inOrder.verify(subscriber, times(1)).onNext("Hello");
        inOrder.verify(subscriber, times(1)).onNext("world!");
        inOrder.verify(subscriber, times(1)).onComplete();
        inOrder.verifyNoMoreInteractions();

        // The resouce should be closed

            

Reported by PMD.

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

Line: 98

              
        InOrder inOrder = inOrder(subscriber);
        inOrder.verify(subscriber, times(1)).onNext("Hello");
        inOrder.verify(subscriber, times(1)).onNext("world!");
        inOrder.verify(subscriber, times(1)).onComplete();
        inOrder.verifyNoMoreInteractions();

        // The resouce should be closed
        verify(resource, times(1)).dispose();

            

Reported by PMD.

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

Line: 98

              
        InOrder inOrder = inOrder(subscriber);
        inOrder.verify(subscriber, times(1)).onNext("Hello");
        inOrder.verify(subscriber, times(1)).onNext("world!");
        inOrder.verify(subscriber, times(1)).onComplete();
        inOrder.verifyNoMoreInteractions();

        // The resouce should be closed
        verify(resource, times(1)).dispose();

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRepeatTest.java
128 issues
System.out.println is used
Design

Line: 186

                      .concatMap(new Function<Integer, Flowable<Integer>>() {
            @Override
            public Flowable<Integer> apply(Integer x) {
                System.out.println("testRepeatRetarget -> " + x);
                concatBase.add(x);
                return Flowable.<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.flowable;

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.subscribers.TestSubscriber;
import io.reactivex.rxjava3.testsupport.*;

public class FlowableRepeatTest {

    @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() {
        Flowable<Integer> xs = Flowable.just(1, 2);

            

Reported by PMD.

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

Line: 60

                  @Test
    public void repeatTake() {
        Flowable<Integer> xs = Flowable.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() {
        Flowable<Integer> xs = Flowable.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() {
        Flowable<Integer> xs = Flowable.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() {
        Flowable<Integer> xs = Flowable.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() {
        Flowable<Integer> xs = Flowable.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() {
        Flowable<Integer> xs = Flowable.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/test/java/io/reactivex/rxjava3/validators/JavadocCodesAndLinks.java
128 issues
This class has too many methods, consider refactoring it.
Design

Line: 31

               * The check ignores html tag content on a line, &#64;see and &#64;throws entries
 * and &lt;code&gt;&lt;/code&gt; lines.
 */
public class JavadocCodesAndLinks {

    @Test
    public void checkFlowable() throws Exception {
        checkSource("Flowable", "io.reactivex.rxjava3.core");
    }

            

Reported by PMD.

The class 'JavadocCodesAndLinks' has a Standard Cyclomatic Complexity of 4 (Highest = 33).
Design

Line: 31

               * The check ignores html tag content on a line, &#64;see and &#64;throws entries
 * and &lt;code&gt;&lt;/code&gt; lines.
 */
public class JavadocCodesAndLinks {

    @Test
    public void checkFlowable() throws Exception {
        checkSource("Flowable", "io.reactivex.rxjava3.core");
    }

            

Reported by PMD.

The class 'JavadocCodesAndLinks' has a Modified Cyclomatic Complexity of 4 (Highest = 33).
Design

Line: 31

               * The check ignores html tag content on a line, &#64;see and &#64;throws entries
 * and &lt;code&gt;&lt;/code&gt; lines.
 */
public class JavadocCodesAndLinks {

    @Test
    public void checkFlowable() throws Exception {
        checkSource("Flowable", "io.reactivex.rxjava3.core");
    }

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 34

              public class JavadocCodesAndLinks {

    @Test
    public void checkFlowable() throws Exception {
        checkSource("Flowable", "io.reactivex.rxjava3.core");
    }

    @Test
    public void checkCompletable() throws Exception {

            

Reported by PMD.

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

Line: 34

              public class JavadocCodesAndLinks {

    @Test
    public void checkFlowable() throws Exception {
        checkSource("Flowable", "io.reactivex.rxjava3.core");
    }

    @Test
    public void checkCompletable() throws Exception {

            

Reported by PMD.

The String literal 'io.reactivex.rxjava3.core' appears 5 times in this file; the first occurrence is on line 35
Error

Line: 35

              
    @Test
    public void checkFlowable() throws Exception {
        checkSource("Flowable", "io.reactivex.rxjava3.core");
    }

    @Test
    public void checkCompletable() throws Exception {
        checkSource("Completable", "io.reactivex.rxjava3.core");

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 39

                  }

    @Test
    public void checkCompletable() throws Exception {
        checkSource("Completable", "io.reactivex.rxjava3.core");
    }

    @Test
    public void checkSingle() throws Exception {

            

Reported by PMD.

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

Line: 39

                  }

    @Test
    public void checkCompletable() throws Exception {
        checkSource("Completable", "io.reactivex.rxjava3.core");
    }

    @Test
    public void checkSingle() throws Exception {

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 44

                  }

    @Test
    public void checkSingle() throws Exception {
        checkSource("Single", "io.reactivex.rxjava3.core");
    }

    @Test
    public void checkMaybe() throws Exception {

            

Reported by PMD.

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

Line: 44

                  }

    @Test
    public void checkSingle() throws Exception {
        checkSource("Single", "io.reactivex.rxjava3.core");
    }

    @Test
    public void checkMaybe() throws Exception {

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMergeWithMaybeTest.java
128 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 FlowableMergeWithMaybeTest extends RxJavaTest {

    @Test
    public void normal() {
        Flowable.range(1, 5)
        .mergeWith(Maybe.just(100))

            

Reported by PMD.

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

Line: 38

              public class FlowableMergeWithMaybeTest extends RxJavaTest {

    @Test
    public void normal() {
        Flowable.range(1, 5)
        .mergeWith(Maybe.just(100))
        .test()
        .assertResult(1, 2, 3, 4, 5, 100);
    }

            

Reported by PMD.

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

Line: 39

              
    @Test
    public void normal() {
        Flowable.range(1, 5)
        .mergeWith(Maybe.just(100))
        .test()
        .assertResult(1, 2, 3, 4, 5, 100);
    }


            

Reported by PMD.

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

Line: 39

              
    @Test
    public void normal() {
        Flowable.range(1, 5)
        .mergeWith(Maybe.just(100))
        .test()
        .assertResult(1, 2, 3, 4, 5, 100);
    }


            

Reported by PMD.

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

Line: 39

              
    @Test
    public void normal() {
        Flowable.range(1, 5)
        .mergeWith(Maybe.just(100))
        .test()
        .assertResult(1, 2, 3, 4, 5, 100);
    }


            

Reported by PMD.

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

Line: 46

                  }

    @Test
    public void emptyOther() {
        Flowable.range(1, 5)
        .mergeWith(Maybe.<Integer>empty())
        .test()
        .assertResult(1, 2, 3, 4, 5);
    }

            

Reported by PMD.

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

Line: 47

              
    @Test
    public void emptyOther() {
        Flowable.range(1, 5)
        .mergeWith(Maybe.<Integer>empty())
        .test()
        .assertResult(1, 2, 3, 4, 5);
    }


            

Reported by PMD.

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

Line: 47

              
    @Test
    public void emptyOther() {
        Flowable.range(1, 5)
        .mergeWith(Maybe.<Integer>empty())
        .test()
        .assertResult(1, 2, 3, 4, 5);
    }


            

Reported by PMD.

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

Line: 47

              
    @Test
    public void emptyOther() {
        Flowable.range(1, 5)
        .mergeWith(Maybe.<Integer>empty())
        .test()
        .assertResult(1, 2, 3, 4, 5);
    }


            

Reported by PMD.

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

Line: 54

                  }

    @Test
    public void normalLong() {
        Flowable.range(1, 512)
        .mergeWith(Maybe.just(100))
        .test()
        .assertValueCount(513)
        .assertComplete();

            

Reported by PMD.

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

Line: 33

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

public class FlowableTakeLastTimedTest extends RxJavaTest {

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

            

Reported by PMD.

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

Line: 37

              
    @Test(expected = IllegalArgumentException.class)
    public void takeLastTimedWithNegativeCount() {
        Flowable.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: 47

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

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

        Subscriber<Object> subscriber = TestHelper.mockSubscriber();

        InOrder inOrder = inOrder(subscriber);


            

Reported by PMD.

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

Line: 53

              
        InOrder inOrder = inOrder(subscriber);

        result.subscribe(subscriber);

        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: 55

              
        result.subscribe(subscriber);

        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: 57

              
        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: 59

                      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: 61

                      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: 63

                      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(subscriber, times(1)).onNext(2);
        inOrder.verify(subscriber, times(1)).onNext(3);

            

Reported by PMD.

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

Line: 65

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

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

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/jdk8/ParallelMapTryOptionalTest.java
127 issues
This class has too many methods, consider refactoring it.
Design

Line: 28

              import io.reactivex.rxjava3.plugins.RxJavaPlugins;
import io.reactivex.rxjava3.testsupport.*;

public class ParallelMapTryOptionalTest extends RxJavaTest implements Consumer<Object> {

    volatile int calls;

    @Override
    public void accept(Object t) throws Exception {

            

Reported by PMD.

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

Line: 30

              
public class ParallelMapTryOptionalTest extends RxJavaTest implements Consumer<Object> {

    volatile int calls;

    @Override
    public void accept(Object t) throws Exception {
        calls++;
    }

            

Reported by PMD.

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

Line: 38

                  }

    @Test
    public void mapNoError() {
        for (ParallelFailureHandling e : ParallelFailureHandling.values()) {
            Flowable.just(1)
            .parallel(1)
            .mapOptional(Optional::of, e)
            .sequential()

            

Reported by PMD.

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

Line: 40

                  @Test
    public void mapNoError() {
        for (ParallelFailureHandling e : ParallelFailureHandling.values()) {
            Flowable.just(1)
            .parallel(1)
            .mapOptional(Optional::of, e)
            .sequential()
            .test()
            .assertResult(1);

            

Reported by PMD.

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

Line: 40

                  @Test
    public void mapNoError() {
        for (ParallelFailureHandling e : ParallelFailureHandling.values()) {
            Flowable.just(1)
            .parallel(1)
            .mapOptional(Optional::of, e)
            .sequential()
            .test()
            .assertResult(1);

            

Reported by PMD.

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

Line: 40

                  @Test
    public void mapNoError() {
        for (ParallelFailureHandling e : ParallelFailureHandling.values()) {
            Flowable.just(1)
            .parallel(1)
            .mapOptional(Optional::of, e)
            .sequential()
            .test()
            .assertResult(1);

            

Reported by PMD.

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

Line: 40

                  @Test
    public void mapNoError() {
        for (ParallelFailureHandling e : ParallelFailureHandling.values()) {
            Flowable.just(1)
            .parallel(1)
            .mapOptional(Optional::of, e)
            .sequential()
            .test()
            .assertResult(1);

            

Reported by PMD.

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

Line: 40

                  @Test
    public void mapNoError() {
        for (ParallelFailureHandling e : ParallelFailureHandling.values()) {
            Flowable.just(1)
            .parallel(1)
            .mapOptional(Optional::of, e)
            .sequential()
            .test()
            .assertResult(1);

            

Reported by PMD.

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

Line: 50

                  }

    @Test
    public void mapErrorNoError() {
        for (ParallelFailureHandling e : ParallelFailureHandling.values()) {
            Flowable.<Integer>error(new TestException())
            .parallel(1)
            .mapOptional(Optional::of, e)
            .sequential()

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 52

                  @Test
    public void mapErrorNoError() {
        for (ParallelFailureHandling e : ParallelFailureHandling.values()) {
            Flowable.<Integer>error(new TestException())
            .parallel(1)
            .mapOptional(Optional::of, e)
            .sequential()
            .test()
            .assertFailure(TestException.class);

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeLongTest.java
127 issues
Avoid throwing raw exception types.
Design

Line: 220

              
            @Override
            public void onError(Throwable e) {
                throw new RuntimeException(e);
            }

            @Override
            public void onNext(Long t) {
                count.incrementAndGet();

            

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.flowable;

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: 33

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

public class FlowableRangeLongTest extends RxJavaTest {

    @Test
    public void rangeStartAt2Count3() {
        Subscriber<Long> subscriber = TestHelper.mockSubscriber();


            

Reported by PMD.

Possible God Class (WMC=50, ATFD=29, TCC=0.000%)
Design

Line: 33

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

public class FlowableRangeLongTest extends RxJavaTest {

    @Test
    public void rangeStartAt2Count3() {
        Subscriber<Long> subscriber = TestHelper.mockSubscriber();


            

Reported by PMD.

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

Line: 39

                  public void rangeStartAt2Count3() {
        Subscriber<Long> subscriber = TestHelper.mockSubscriber();

        Flowable.rangeLong(2, 3).subscribe(subscriber);

        verify(subscriber, times(1)).onNext(2L);
        verify(subscriber, times(1)).onNext(3L);
        verify(subscriber, times(1)).onNext(4L);
        verify(subscriber, never()).onNext(5L);

            

Reported by PMD.

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

Line: 41

              
        Flowable.rangeLong(2, 3).subscribe(subscriber);

        verify(subscriber, times(1)).onNext(2L);
        verify(subscriber, times(1)).onNext(3L);
        verify(subscriber, times(1)).onNext(4L);
        verify(subscriber, never()).onNext(5L);
        verify(subscriber, never()).onError(any(Throwable.class));
        verify(subscriber, times(1)).onComplete();

            

Reported by PMD.

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

Line: 42

                      Flowable.rangeLong(2, 3).subscribe(subscriber);

        verify(subscriber, times(1)).onNext(2L);
        verify(subscriber, times(1)).onNext(3L);
        verify(subscriber, times(1)).onNext(4L);
        verify(subscriber, never()).onNext(5L);
        verify(subscriber, never()).onError(any(Throwable.class));
        verify(subscriber, times(1)).onComplete();
    }

            

Reported by PMD.

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

Line: 43

              
        verify(subscriber, times(1)).onNext(2L);
        verify(subscriber, times(1)).onNext(3L);
        verify(subscriber, times(1)).onNext(4L);
        verify(subscriber, never()).onNext(5L);
        verify(subscriber, never()).onError(any(Throwable.class));
        verify(subscriber, times(1)).onComplete();
    }


            

Reported by PMD.

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

Line: 44

                      verify(subscriber, times(1)).onNext(2L);
        verify(subscriber, times(1)).onNext(3L);
        verify(subscriber, times(1)).onNext(4L);
        verify(subscriber, never()).onNext(5L);
        verify(subscriber, never()).onError(any(Throwable.class));
        verify(subscriber, times(1)).onComplete();
    }

    @Test

            

Reported by PMD.

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

Line: 45

                      verify(subscriber, times(1)).onNext(3L);
        verify(subscriber, times(1)).onNext(4L);
        verify(subscriber, never()).onNext(5L);
        verify(subscriber, never()).onError(any(Throwable.class));
        verify(subscriber, times(1)).onComplete();
    }

    @Test
    public void rangeUnsubscribe() {

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/mixed/ObservableConcatMapSingleTest.java
125 issues
This class has too many methods, consider refactoring it.
Design

Line: 35

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

public class ObservableConcatMapSingleTest extends RxJavaTest {

    @Test
    public void simple() {
        Observable.range(1, 5)
        .concatMapSingle(new Function<Integer, SingleSource<Integer>>() {

            

Reported by PMD.

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

Line: 38

              public class ObservableConcatMapSingleTest extends RxJavaTest {

    @Test
    public void simple() {
        Observable.range(1, 5)
        .concatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override
            public SingleSource<Integer> apply(Integer v)
                    throws Exception {

            

Reported by PMD.

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

Line: 52

                  }

    @Test
    public void simpleLong() {
        Observable.range(1, 1024)
        .concatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override
            public SingleSource<Integer> apply(Integer v)
                    throws Exception {

            

Reported by PMD.

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

Line: 68

                  }

    @Test
    public void mainError() {
        Observable.error(new TestException())
        .concatMapSingle(Functions.justFunction(Single.just(1)))
        .test()
        .assertFailure(TestException.class);
    }

            

Reported by PMD.

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

Line: 76

                  }

    @Test
    public void innerError() {
        Observable.just(1)
        .concatMapSingle(Functions.justFunction(Single.error(new TestException())))
        .test()
        .assertFailure(TestException.class);
    }

            

Reported by PMD.

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

Line: 84

                  }

    @Test
    public void mainBoundaryErrorInnerSuccess() {
        PublishSubject<Integer> ps = PublishSubject.create();
        SingleSubject<Integer> ms = SingleSubject.create();

        TestObserver<Integer> to = ps.concatMapSingleDelayError(Functions.justFunction(ms), false).test();


            

Reported by PMD.

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

Line: 88

                      PublishSubject<Integer> ps = PublishSubject.create();
        SingleSubject<Integer> ms = SingleSubject.create();

        TestObserver<Integer> to = ps.concatMapSingleDelayError(Functions.justFunction(ms), false).test();

        to.assertEmpty();

        ps.onNext(1);


            

Reported by PMD.

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

Line: 88

                      PublishSubject<Integer> ps = PublishSubject.create();
        SingleSubject<Integer> ms = SingleSubject.create();

        TestObserver<Integer> to = ps.concatMapSingleDelayError(Functions.justFunction(ms), false).test();

        to.assertEmpty();

        ps.onNext(1);


            

Reported by PMD.

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

Line: 90

              
        TestObserver<Integer> to = ps.concatMapSingleDelayError(Functions.justFunction(ms), false).test();

        to.assertEmpty();

        ps.onNext(1);

        assertTrue(ms.hasObservers());


            

Reported by PMD.

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

Line: 92

              
        to.assertEmpty();

        ps.onNext(1);

        assertTrue(ms.hasObservers());

        ps.onError(new TestException());


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableToMapTest.java
123 issues
Avoid throwing raw exception types.
Design

Line: 98

                          @Override
            public Integer apply(String t1) {
                if ("bb".equals(t1)) {
                    throw new RuntimeException("Forced Failure");
                }
                return t1.length();
            }
        };
        Observable<Map<Integer, String>> mapped = source.toMap(lengthFuncErr).toObservable();

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 127

                          @Override
            public String apply(String t1) {
                if ("bb".equals(t1)) {
                    throw new RuntimeException("Forced failure");
                }
                return t1 + t1;
            }
        };


            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 200

                      Supplier<Map<Integer, String>> mapFactory = new Supplier<Map<Integer, String>>() {
            @Override
            public Map<Integer, String> get() {
                throw new RuntimeException("Forced failure");
            }
        };

        Function<String, Integer> lengthFunc = new Function<String, Integer>() {
            @Override

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 273

                          @Override
            public Integer apply(String t1) {
                if ("bb".equals(t1)) {
                    throw new RuntimeException("Forced Failure");
                }
                return t1.length();
            }
        };
        Single<Map<Integer, String>> mapped = source.toMap(lengthFuncErr);

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 301

                          @Override
            public String apply(String t1) {
                if ("bb".equals(t1)) {
                    throw new RuntimeException("Forced failure");
                }
                return t1 + t1;
            }
        };


            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 372

                      Supplier<Map<Integer, String>> mapFactory = new Supplier<Map<Integer, String>>() {
            @Override
            public Map<Integer, String> get() {
                throw new RuntimeException("Forced failure");
            }
        };

        Function<String, Integer> lengthFunc = new Function<String, Integer>() {
            @Override

            

Reported by PMD.

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

Line: 29

              import io.reactivex.rxjava3.functions.*;
import io.reactivex.rxjava3.testsupport.TestHelper;

public class ObservableToMapTest extends RxJavaTest {
    Observer<Object> objectObserver;
    SingleObserver<Object> singleObserver;

    @Before
    public void before() {

            

Reported by PMD.

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

Line: 30

              import io.reactivex.rxjava3.testsupport.TestHelper;

public class ObservableToMapTest extends RxJavaTest {
    Observer<Object> objectObserver;
    SingleObserver<Object> singleObserver;

    @Before
    public void before() {
        objectObserver = TestHelper.mockObserver();

            

Reported by PMD.

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

Line: 31

              
public class ObservableToMapTest extends RxJavaTest {
    Observer<Object> objectObserver;
    SingleObserver<Object> singleObserver;

    @Before
    public void before() {
        objectObserver = TestHelper.mockObserver();
        singleObserver = TestHelper.mockSingleObserver();

            

Reported by PMD.

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

Line: 39

                      singleObserver = TestHelper.mockSingleObserver();
    }

    Function<String, Integer> lengthFunc = new Function<String, Integer>() {
        @Override
        public Integer apply(String t1) {
            return t1.length();
        }
    };

            

Reported by PMD.