The following issues were found

src/main/java/io/reactivex/rxjava3/internal/jdk8/ParallelMapTryOptional.java
41 issues
Avoid using a branching statement as the last in a loop.
Error

Line: 170

                                  downstream.onNext(v.get());
                    return true;
                }
                return false;
            }
        }

        @Override
        public void onError(Throwable t) {

            

Reported by PMD.

Avoid using a branching statement as the last in a loop.
Error

Line: 282

                                  }
                }

                return v.isPresent() && downstream.tryOnNext(v.get());
            }
        }

        @Override
        public void onError(Throwable t) {

            

Reported by PMD.

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

Line: 36

               */
public final class ParallelMapTryOptional<T, R> extends ParallelFlowable<R> {

    final ParallelFlowable<T> source;

    final Function<? super T, Optional<? extends R>> mapper;

    final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;


            

Reported by PMD.

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

Line: 38

              
    final ParallelFlowable<T> source;

    final Function<? super T, Optional<? extends R>> mapper;

    final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;

    public ParallelMapTryOptional(
            ParallelFlowable<T> source,

            

Reported by PMD.

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

Line: 40

              
    final Function<? super T, Optional<? extends R>> mapper;

    final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;

    public ParallelMapTryOptional(
            ParallelFlowable<T> source,
            Function<? super T, Optional<? extends R>> mapper,
            BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler) {

            

Reported by PMD.

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

Line: 80

              
    static final class ParallelMapTrySubscriber<T, R> implements ConditionalSubscriber<T>, Subscription {

        final Subscriber<? super R> downstream;

        final Function<? super T, Optional<? extends R>> mapper;

        final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;


            

Reported by PMD.

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

Line: 82

              
        final Subscriber<? super R> downstream;

        final Function<? super T, Optional<? extends R>> mapper;

        final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;

        Subscription upstream;


            

Reported by PMD.

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

Line: 84

              
        final Function<? super T, Optional<? extends R>> mapper;

        final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;

        Subscription upstream;

        boolean done;


            

Reported by PMD.

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

Line: 86

              
        final BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler;

        Subscription upstream;

        boolean done;

        ParallelMapTrySubscriber(Subscriber<? super R> actual,
                Function<? super T, Optional<? extends R>> mapper,

            

Reported by PMD.

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

Line: 88

              
        Subscription upstream;

        boolean done;

        ParallelMapTrySubscriber(Subscriber<? super R> actual,
                Function<? super T, Optional<? extends R>> mapper,
                BiFunction<? super Long, ? super Throwable, ParallelFailureHandling> errorHandler) {
            this.downstream = actual;

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/util/BackpressureHelperTest.java
41 issues
JUnit tests should include assert() or fail()
Design

Line: 29

              
public class BackpressureHelperTest extends RxJavaTest {
    @Test
    public void constructorShouldBePrivate() {
        TestHelper.checkUtilityClass(BackpressureHelper.class);
    }

    @Test
    public void addCap() {

            

Reported by PMD.

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

Line: 34

                  }

    @Test
    public void addCap() {
        assertEquals(2L, BackpressureHelper.addCap(1, 1));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(1, Long.MAX_VALUE - 1));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(1, Long.MAX_VALUE));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(Long.MAX_VALUE - 1, Long.MAX_VALUE - 1));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(Long.MAX_VALUE, Long.MAX_VALUE));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 35

              
    @Test
    public void addCap() {
        assertEquals(2L, BackpressureHelper.addCap(1, 1));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(1, Long.MAX_VALUE - 1));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(1, Long.MAX_VALUE));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(Long.MAX_VALUE - 1, Long.MAX_VALUE - 1));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(Long.MAX_VALUE, Long.MAX_VALUE));
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 36

                  @Test
    public void addCap() {
        assertEquals(2L, BackpressureHelper.addCap(1, 1));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(1, Long.MAX_VALUE - 1));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(1, Long.MAX_VALUE));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(Long.MAX_VALUE - 1, Long.MAX_VALUE - 1));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(Long.MAX_VALUE, Long.MAX_VALUE));
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 37

                  public void addCap() {
        assertEquals(2L, BackpressureHelper.addCap(1, 1));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(1, Long.MAX_VALUE - 1));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(1, Long.MAX_VALUE));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(Long.MAX_VALUE - 1, Long.MAX_VALUE - 1));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(Long.MAX_VALUE, Long.MAX_VALUE));
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 38

                      assertEquals(2L, BackpressureHelper.addCap(1, 1));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(1, Long.MAX_VALUE - 1));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(1, Long.MAX_VALUE));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(Long.MAX_VALUE - 1, Long.MAX_VALUE - 1));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(Long.MAX_VALUE, Long.MAX_VALUE));
    }

    @Test
    public void multiplyCap() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 39

                      assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(1, Long.MAX_VALUE - 1));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(1, Long.MAX_VALUE));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(Long.MAX_VALUE - 1, Long.MAX_VALUE - 1));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.addCap(Long.MAX_VALUE, Long.MAX_VALUE));
    }

    @Test
    public void multiplyCap() {
        assertEquals(6, BackpressureHelper.multiplyCap(2, 3));

            

Reported by PMD.

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

Line: 43

                  }

    @Test
    public void multiplyCap() {
        assertEquals(6, BackpressureHelper.multiplyCap(2, 3));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.multiplyCap(2, Long.MAX_VALUE));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.multiplyCap(Long.MAX_VALUE, Long.MAX_VALUE));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.multiplyCap(1L << 32, 1L << 32));


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 44

              
    @Test
    public void multiplyCap() {
        assertEquals(6, BackpressureHelper.multiplyCap(2, 3));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.multiplyCap(2, Long.MAX_VALUE));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.multiplyCap(Long.MAX_VALUE, Long.MAX_VALUE));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.multiplyCap(1L << 32, 1L << 32));

    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 45

                  @Test
    public void multiplyCap() {
        assertEquals(6, BackpressureHelper.multiplyCap(2, 3));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.multiplyCap(2, Long.MAX_VALUE));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.multiplyCap(Long.MAX_VALUE, Long.MAX_VALUE));
        assertEquals(Long.MAX_VALUE, BackpressureHelper.multiplyCap(1L << 32, 1L << 32));

    }


            

Reported by PMD.

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

Line: 27

              import io.reactivex.rxjava3.schedulers.Schedulers;
import io.reactivex.rxjava3.testsupport.TestHelper;

public class FlowableIntervalRangeTest extends RxJavaTest {
    @Test
    public void simple() throws Exception {
        Flowable.intervalRange(5, 5, 50, 50, TimeUnit.MILLISECONDS)
        .test()
        .awaitDone(5, TimeUnit.SECONDS)

            

Reported by PMD.

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

Line: 29

              
public class FlowableIntervalRangeTest extends RxJavaTest {
    @Test
    public void simple() throws Exception {
        Flowable.intervalRange(5, 5, 50, 50, TimeUnit.MILLISECONDS)
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult(5L, 6L, 7L, 8L, 9L);
    }

            

Reported by PMD.

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

Line: 29

              
public class FlowableIntervalRangeTest extends RxJavaTest {
    @Test
    public void simple() throws Exception {
        Flowable.intervalRange(5, 5, 50, 50, TimeUnit.MILLISECONDS)
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult(5L, 6L, 7L, 8L, 9L);
    }

            

Reported by PMD.

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

Line: 30

              public class FlowableIntervalRangeTest extends RxJavaTest {
    @Test
    public void simple() throws Exception {
        Flowable.intervalRange(5, 5, 50, 50, TimeUnit.MILLISECONDS)
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult(5L, 6L, 7L, 8L, 9L);
    }


            

Reported by PMD.

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

Line: 30

              public class FlowableIntervalRangeTest extends RxJavaTest {
    @Test
    public void simple() throws Exception {
        Flowable.intervalRange(5, 5, 50, 50, TimeUnit.MILLISECONDS)
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult(5L, 6L, 7L, 8L, 9L);
    }


            

Reported by PMD.

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

Line: 30

              public class FlowableIntervalRangeTest extends RxJavaTest {
    @Test
    public void simple() throws Exception {
        Flowable.intervalRange(5, 5, 50, 50, TimeUnit.MILLISECONDS)
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult(5L, 6L, 7L, 8L, 9L);
    }


            

Reported by PMD.

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

Line: 37

                  }

    @Test
    public void customScheduler() {
        Flowable.intervalRange(1, 5, 1, 1, TimeUnit.MILLISECONDS, Schedulers.single())
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult(1L, 2L, 3L, 4L, 5L);
    }

            

Reported by PMD.

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

Line: 38

              
    @Test
    public void customScheduler() {
        Flowable.intervalRange(1, 5, 1, 1, TimeUnit.MILLISECONDS, Schedulers.single())
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult(1L, 2L, 3L, 4L, 5L);
    }


            

Reported by PMD.

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

Line: 38

              
    @Test
    public void customScheduler() {
        Flowable.intervalRange(1, 5, 1, 1, TimeUnit.MILLISECONDS, Schedulers.single())
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult(1L, 2L, 3L, 4L, 5L);
    }


            

Reported by PMD.

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

Line: 38

              
    @Test
    public void customScheduler() {
        Flowable.intervalRange(1, 5, 1, 1, TimeUnit.MILLISECONDS, Schedulers.single())
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult(1L, 2L, 3L, 4L, 5L);
    }


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/jdk8/FlowableCollectWithCollectorTest.java
41 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.jdk8;

import static org.junit.Assert.assertFalse;

import java.io.IOException;
import java.util.*;

            

Reported by PMD.

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

Line: 32

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

public class FlowableCollectWithCollectorTest extends RxJavaTest {

    @Test
    public void basic() {
        Flowable.range(1, 5)
        .collect(Collectors.toList())

            

Reported by PMD.

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

Line: 35

              public class FlowableCollectWithCollectorTest extends RxJavaTest {

    @Test
    public void basic() {
        Flowable.range(1, 5)
        .collect(Collectors.toList())
        .test()
        .assertResult(Arrays.asList(1, 2, 3, 4, 5));
    }

            

Reported by PMD.

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

Line: 36

              
    @Test
    public void basic() {
        Flowable.range(1, 5)
        .collect(Collectors.toList())
        .test()
        .assertResult(Arrays.asList(1, 2, 3, 4, 5));
    }


            

Reported by PMD.

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

Line: 36

              
    @Test
    public void basic() {
        Flowable.range(1, 5)
        .collect(Collectors.toList())
        .test()
        .assertResult(Arrays.asList(1, 2, 3, 4, 5));
    }


            

Reported by PMD.

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

Line: 36

              
    @Test
    public void basic() {
        Flowable.range(1, 5)
        .collect(Collectors.toList())
        .test()
        .assertResult(Arrays.asList(1, 2, 3, 4, 5));
    }


            

Reported by PMD.

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

Line: 43

                  }

    @Test
    public void empty() {
        Flowable.empty()
        .collect(Collectors.toList())
        .test()
        .assertResult(Collections.emptyList());
    }

            

Reported by PMD.

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

Line: 44

              
    @Test
    public void empty() {
        Flowable.empty()
        .collect(Collectors.toList())
        .test()
        .assertResult(Collections.emptyList());
    }


            

Reported by PMD.

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

Line: 44

              
    @Test
    public void empty() {
        Flowable.empty()
        .collect(Collectors.toList())
        .test()
        .assertResult(Collections.emptyList());
    }


            

Reported by PMD.

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

Line: 44

              
    @Test
    public void empty() {
        Flowable.empty()
        .collect(Collectors.toList())
        .test()
        .assertResult(Collections.emptyList());
    }


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromRunnableTest.java
41 issues
JUnit assertions should include a message
Design

Line: 48

                          .test()
            .assertResult();

        assertEquals(1, atomicInteger.get());
    }

    @Test
    public void fromRunnableTwice() {
        final AtomicInteger atomicInteger = new AtomicInteger();

            

Reported by PMD.

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

Line: 52

                  }

    @Test
    public void fromRunnableTwice() {
        final AtomicInteger atomicInteger = new AtomicInteger();

        Runnable run = new Runnable() {
            @Override
            public void run() {

            

Reported by PMD.

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

Line: 62

                          }
        };

        Flowable.fromRunnable(run)
            .test()
            .assertResult();

        assertEquals(1, atomicInteger.get());


            

Reported by PMD.

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

Line: 62

                          }
        };

        Flowable.fromRunnable(run)
            .test()
            .assertResult();

        assertEquals(1, atomicInteger.get());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 66

                          .test()
            .assertResult();

        assertEquals(1, atomicInteger.get());

        Flowable.fromRunnable(run)
            .test()
            .assertResult();


            

Reported by PMD.

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

Line: 68

              
        assertEquals(1, atomicInteger.get());

        Flowable.fromRunnable(run)
            .test()
            .assertResult();

        assertEquals(2, atomicInteger.get());
    }

            

Reported by PMD.

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

Line: 68

              
        assertEquals(1, atomicInteger.get());

        Flowable.fromRunnable(run)
            .test()
            .assertResult();

        assertEquals(2, atomicInteger.get());
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 72

                          .test()
            .assertResult();

        assertEquals(2, atomicInteger.get());
    }

    @Test
    public void fromRunnableInvokesLazy() {
        final AtomicInteger atomicInteger = new AtomicInteger();

            

Reported by PMD.

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

Line: 76

                  }

    @Test
    public void fromRunnableInvokesLazy() {
        final AtomicInteger atomicInteger = new AtomicInteger();

        Flowable<Object> source = Flowable.fromRunnable(new Runnable() {
            @Override
            public void run() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 86

                          }
        });

        assertEquals(0, atomicInteger.get());

        source
            .test()
            .assertResult();


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/flowable/FlowableStartWithTests.java
41 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 27

              public class FlowableStartWithTests extends RxJavaTest {

    @Test
    public void startWith1() {
        List<String> values = Flowable.just("one", "two")
                .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));

            

Reported by PMD.

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

Line: 28

              
    @Test
    public void startWith1() {
        List<String> values = Flowable.just("one", "two")
                .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));
    }

            

Reported by PMD.

The String literal 'two' appears 6 times in this file; the first occurrence is on line 28
Error

Line: 28

              
    @Test
    public void startWith1() {
        List<String> values = Flowable.just("one", "two")
                .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));
    }

            

Reported by PMD.

The String literal 'one' appears 5 times in this file; the first occurrence is on line 28
Error

Line: 28

              
    @Test
    public void startWith1() {
        List<String> values = Flowable.just("one", "two")
                .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));
    }

            

Reported by PMD.

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

Line: 28

              
    @Test
    public void startWith1() {
        List<String> values = Flowable.just("one", "two")
                .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));
    }

            

Reported by PMD.

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

Line: 28

              
    @Test
    public void startWith1() {
        List<String> values = Flowable.just("one", "two")
                .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));
    }

            

Reported by PMD.

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

Line: 31

                      List<String> values = Flowable.just("one", "two")
                .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));
    }

    @Test
    public void startWithIterable() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 31

                      List<String> values = Flowable.just("one", "two")
                .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));
    }

    @Test
    public void startWithIterable() {

            

Reported by PMD.

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

Line: 32

                              .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));
    }

    @Test
    public void startWithIterable() {
        List<String> li = new ArrayList<>();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 32

                              .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));
    }

    @Test
    public void startWithIterable() {
        List<String> li = new ArrayList<>();

            

Reported by PMD.

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

Line: 32

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

public class BlockingObservableLatestTest extends RxJavaTest {
    @Test
    public void simple() {
        TestScheduler scheduler = new TestScheduler();

        Observable<Long> source = Observable.interval(1, TimeUnit.SECONDS, scheduler).take(10);

            

Reported by PMD.

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

Line: 37

                  public void simple() {
        TestScheduler scheduler = new TestScheduler();

        Observable<Long> source = Observable.interval(1, TimeUnit.SECONDS, scheduler).take(10);

        Iterable<Long> iter = source.blockingLatest();

        Iterator<Long> it = iter.iterator();


            

Reported by PMD.

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

Line: 39

              
        Observable<Long> source = Observable.interval(1, TimeUnit.SECONDS, scheduler).take(10);

        Iterable<Long> iter = source.blockingLatest();

        Iterator<Long> it = iter.iterator();

        // only 9 because take(10) will immediately call onComplete when receiving the 10th item
        // which onComplete will overwrite the previous value

            

Reported by PMD.

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

Line: 41

              
        Iterable<Long> iter = source.blockingLatest();

        Iterator<Long> it = iter.iterator();

        // only 9 because take(10) will immediately call onComplete when receiving the 10th item
        // which onComplete will overwrite the previous value
        for (int i = 0; i < 9; i++) {
            scheduler.advanceTimeBy(1, TimeUnit.SECONDS);

            

Reported by PMD.

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

Line: 61

                  public void sameSourceMultipleIterators() {
        TestScheduler scheduler = new TestScheduler();

        Observable<Long> source = Observable.interval(1, TimeUnit.SECONDS, scheduler).take(10);

        Iterable<Long> iter = source.blockingLatest();

        for (int j = 0; j < 3; j++) {
            Iterator<Long> it = iter.iterator();

            

Reported by PMD.

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

Line: 63

              
        Observable<Long> source = Observable.interval(1, TimeUnit.SECONDS, scheduler).take(10);

        Iterable<Long> iter = source.blockingLatest();

        for (int j = 0; j < 3; j++) {
            Iterator<Long> it = iter.iterator();

            // only 9 because take(10) will immediately call onComplete when receiving the 10th item

            

Reported by PMD.

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

Line: 87

                  public void empty() {
        Observable<Long> source = Observable.<Long> empty();

        Iterable<Long> iter = source.blockingLatest();

        Iterator<Long> it = iter.iterator();

        Assert.assertFalse(it.hasNext());


            

Reported by PMD.

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

Line: 89

              
        Iterable<Long> iter = source.blockingLatest();

        Iterator<Long> it = iter.iterator();

        Assert.assertFalse(it.hasNext());

        it.next();
    }

            

Reported by PMD.

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

Line: 100

                  public void simpleJustNext() {
        TestScheduler scheduler = new TestScheduler();

        Observable<Long> source = Observable.interval(1, TimeUnit.SECONDS, scheduler).take(10);

        Iterable<Long> iter = source.blockingLatest();

        Iterator<Long> it = iter.iterator();


            

Reported by PMD.

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

Line: 102

              
        Observable<Long> source = Observable.interval(1, TimeUnit.SECONDS, scheduler).take(10);

        Iterable<Long> iter = source.blockingLatest();

        Iterator<Long> it = iter.iterator();

        // only 9 because take(10) will immediately call onComplete when receiving the 10th item
        // which onComplete will overwrite the previous value

            

Reported by PMD.

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

Line: 32

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

public class MaybeZipIterableTest extends RxJavaTest {

    final Function<Object[], Object> addString = new Function<Object[], Object>() {
        @Override
        public Object apply(Object[] a) throws Exception {
            return Arrays.toString(a);

            

Reported by PMD.

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

Line: 34

              
public class MaybeZipIterableTest extends RxJavaTest {

    final Function<Object[], Object> addString = new Function<Object[], Object>() {
        @Override
        public Object apply(Object[] a) throws Exception {
            return Arrays.toString(a);
        }
    };

            

Reported by PMD.

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

Line: 42

                  };

    @Test
    public void firstError() {
        Maybe.zip(Arrays.asList(Maybe.error(new TestException()), Maybe.just(1)), addString)
        .test()
        .assertFailure(TestException.class);
    }


            

Reported by PMD.

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

Line: 49

                  }

    @Test
    public void secondError() {
        Maybe.zip(Arrays.asList(Maybe.just(1), Maybe.<Integer>error(new TestException())), addString)
        .test()
        .assertFailure(TestException.class);
    }


            

Reported by PMD.

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

Line: 56

                  }

    @Test
    public void dispose() {
        PublishProcessor<Integer> pp = PublishProcessor.create();

        TestObserver<Object> to = Maybe.zip(Arrays.asList(pp.singleElement(), pp.singleElement()), addString)
        .test();


            

Reported by PMD.

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

Line: 59

                  public void dispose() {
        PublishProcessor<Integer> pp = PublishProcessor.create();

        TestObserver<Object> to = Maybe.zip(Arrays.asList(pp.singleElement(), pp.singleElement()), addString)
        .test();

        assertTrue(pp.hasSubscribers());

        to.dispose();

            

Reported by PMD.

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

Line: 59

                  public void dispose() {
        PublishProcessor<Integer> pp = PublishProcessor.create();

        TestObserver<Object> to = Maybe.zip(Arrays.asList(pp.singleElement(), pp.singleElement()), addString)
        .test();

        assertTrue(pp.hasSubscribers());

        to.dispose();

            

Reported by PMD.

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

Line: 59

                  public void dispose() {
        PublishProcessor<Integer> pp = PublishProcessor.create();

        TestObserver<Object> to = Maybe.zip(Arrays.asList(pp.singleElement(), pp.singleElement()), addString)
        .test();

        assertTrue(pp.hasSubscribers());

        to.dispose();

            

Reported by PMD.

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

Line: 62

                      TestObserver<Object> to = Maybe.zip(Arrays.asList(pp.singleElement(), pp.singleElement()), addString)
        .test();

        assertTrue(pp.hasSubscribers());

        to.dispose();

        assertFalse(pp.hasSubscribers());
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 62

                      TestObserver<Object> to = Maybe.zip(Arrays.asList(pp.singleElement(), pp.singleElement()), addString)
        .test();

        assertTrue(pp.hasSubscribers());

        to.dispose();

        assertFalse(pp.hasSubscribers());
    }

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableFromRunnableTest.java
41 issues
JUnit assertions should include a message
Design

Line: 48

                          .test()
            .assertResult();

        assertEquals(1, atomicInteger.get());
    }

    @Test
    public void fromRunnableTwice() {
        final AtomicInteger atomicInteger = new AtomicInteger();

            

Reported by PMD.

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

Line: 52

                  }

    @Test
    public void fromRunnableTwice() {
        final AtomicInteger atomicInteger = new AtomicInteger();

        Runnable run = new Runnable() {
            @Override
            public void run() {

            

Reported by PMD.

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

Line: 62

                          }
        };

        Observable.fromRunnable(run)
            .test()
            .assertResult();

        assertEquals(1, atomicInteger.get());


            

Reported by PMD.

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

Line: 62

                          }
        };

        Observable.fromRunnable(run)
            .test()
            .assertResult();

        assertEquals(1, atomicInteger.get());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 66

                          .test()
            .assertResult();

        assertEquals(1, atomicInteger.get());

        Observable.fromRunnable(run)
            .test()
            .assertResult();


            

Reported by PMD.

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

Line: 68

              
        assertEquals(1, atomicInteger.get());

        Observable.fromRunnable(run)
            .test()
            .assertResult();

        assertEquals(2, atomicInteger.get());
    }

            

Reported by PMD.

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

Line: 68

              
        assertEquals(1, atomicInteger.get());

        Observable.fromRunnable(run)
            .test()
            .assertResult();

        assertEquals(2, atomicInteger.get());
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 72

                          .test()
            .assertResult();

        assertEquals(2, atomicInteger.get());
    }

    @Test
    public void fromRunnableInvokesLazy() {
        final AtomicInteger atomicInteger = new AtomicInteger();

            

Reported by PMD.

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

Line: 76

                  }

    @Test
    public void fromRunnableInvokesLazy() {
        final AtomicInteger atomicInteger = new AtomicInteger();

        Observable<Object> source = Observable.fromRunnable(new Runnable() {
            @Override
            public void run() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 86

                          }
        });

        assertEquals(0, atomicInteger.get());

        source
            .test()
            .assertResult();


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/observable/ObservableStartWithTests.java
40 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 28

              public class ObservableStartWithTests extends RxJavaTest {

    @Test
    public void startWith1() {
        List<String> values = Observable.just("one", "two")
                .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));

            

Reported by PMD.

The String literal 'two' appears 6 times in this file; the first occurrence is on line 29
Error

Line: 29

              
    @Test
    public void startWith1() {
        List<String> values = Observable.just("one", "two")
                .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));
    }

            

Reported by PMD.

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

Line: 29

              
    @Test
    public void startWith1() {
        List<String> values = Observable.just("one", "two")
                .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));
    }

            

Reported by PMD.

The String literal 'one' appears 5 times in this file; the first occurrence is on line 29
Error

Line: 29

              
    @Test
    public void startWith1() {
        List<String> values = Observable.just("one", "two")
                .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));
    }

            

Reported by PMD.

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

Line: 29

              
    @Test
    public void startWith1() {
        List<String> values = Observable.just("one", "two")
                .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));
    }

            

Reported by PMD.

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

Line: 29

              
    @Test
    public void startWith1() {
        List<String> values = Observable.just("one", "two")
                .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));
    }

            

Reported by PMD.

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

Line: 32

                      List<String> values = Observable.just("one", "two")
                .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));
    }

    @Test
    public void startWithIterable() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 32

                      List<String> values = Observable.just("one", "two")
                .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));
    }

    @Test
    public void startWithIterable() {

            

Reported by PMD.

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

Line: 33

                              .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));
    }

    @Test
    public void startWithIterable() {
        List<String> li = new ArrayList<>();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 33

                              .startWithArray("zero").toList().blockingGet();

        assertEquals("zero", values.get(0));
        assertEquals("two", values.get(2));
    }

    @Test
    public void startWithIterable() {
        List<String> li = new ArrayList<>();

            

Reported by PMD.