The following issues were found

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFromSupplierTest.java
44 issues
The String literal 'unchecked' appears 4 times in this file; the first occurrence is on line 38
Error

Line: 38

              
public class FlowableFromSupplierTest extends RxJavaTest {

    @SuppressWarnings("unchecked")
    @Test
    public void shouldNotInvokeFuncUntilSubscription() throws Throwable {
        Supplier<Object> func = mock(Supplier.class);

        when(func.get()).thenReturn(new Object());

            

Reported by PMD.

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

Line: 43

                  public void shouldNotInvokeFuncUntilSubscription() throws Throwable {
        Supplier<Object> func = mock(Supplier.class);

        when(func.get()).thenReturn(new Object());

        Flowable<Object> fromSupplierFlowable = Flowable.fromSupplier(func);

        verifyNoInteractions(func);


            

Reported by PMD.

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

Line: 49

              
        verifyNoInteractions(func);

        fromSupplierFlowable.subscribe();

        verify(func).get();
    }

    @SuppressWarnings("unchecked")

            

Reported by PMD.

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

Line: 51

              
        fromSupplierFlowable.subscribe();

        verify(func).get();
    }

    @SuppressWarnings("unchecked")
    @Test
    public void shouldCallOnNextAndOnCompleted() throws Throwable {

            

Reported by PMD.

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

Line: 59

                  public void shouldCallOnNextAndOnCompleted() throws Throwable {
        Supplier<String> func = mock(Supplier.class);

        when(func.get()).thenReturn("test_value");

        Flowable<String> fromSupplierFlowable = Flowable.fromSupplier(func);

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


            

Reported by PMD.

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

Line: 59

                  public void shouldCallOnNextAndOnCompleted() throws Throwable {
        Supplier<String> func = mock(Supplier.class);

        when(func.get()).thenReturn("test_value");

        Flowable<String> fromSupplierFlowable = Flowable.fromSupplier(func);

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


            

Reported by PMD.

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

Line: 65

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

        fromSupplierFlowable.subscribe(subscriber);

        verify(subscriber).onNext("test_value");
        verify(subscriber).onComplete();
        verify(subscriber, never()).onError(any(Throwable.class));
    }

            

Reported by PMD.

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

Line: 67

              
        fromSupplierFlowable.subscribe(subscriber);

        verify(subscriber).onNext("test_value");
        verify(subscriber).onComplete();
        verify(subscriber, never()).onError(any(Throwable.class));
    }

    @SuppressWarnings("unchecked")

            

Reported by PMD.

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

Line: 68

                      fromSupplierFlowable.subscribe(subscriber);

        verify(subscriber).onNext("test_value");
        verify(subscriber).onComplete();
        verify(subscriber, never()).onError(any(Throwable.class));
    }

    @SuppressWarnings("unchecked")
    @Test

            

Reported by PMD.

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

Line: 69

              
        verify(subscriber).onNext("test_value");
        verify(subscriber).onComplete();
        verify(subscriber, never()).onError(any(Throwable.class));
    }

    @SuppressWarnings("unchecked")
    @Test
    public void shouldCallOnError() throws Throwable {

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleZipIterableTest.java
43 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 SingleZipIterableTest 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 SingleZipIterableTest 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() {
        Single.zip(Arrays.asList(Single.error(new TestException()), Single.just(1)), addString)
        .test()
        .assertFailure(TestException.class);
    }


            

Reported by PMD.

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

Line: 49

                  }

    @Test
    public void secondError() {
        Single.zip(Arrays.asList(Single.just(1), Single.<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 = Single.zip(Arrays.asList(pp.single(0), pp.single(0)), 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 = Single.zip(Arrays.asList(pp.single(0), pp.single(0)), 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 = Single.zip(Arrays.asList(pp.single(0), pp.single(0)), 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 = Single.zip(Arrays.asList(pp.single(0), pp.single(0)), addString)
        .test();

        assertTrue(pp.hasSubscribers());

        to.dispose();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 62

                      TestObserver<Object> to = Single.zip(Arrays.asList(pp.single(0), pp.single(0)), addString)
        .test();

        assertTrue(pp.hasSubscribers());

        to.dispose();

        assertFalse(pp.hasSubscribers());
    }

            

Reported by PMD.

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

Line: 62

                      TestObserver<Object> to = Single.zip(Arrays.asList(pp.single(0), pp.single(0)), addString)
        .test();

        assertTrue(pp.hasSubscribers());

        to.dispose();

        assertFalse(pp.hasSubscribers());
    }

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/jdk8/FlowableFromStream.java
43 issues
Avoid reassigning parameters such as 'n'
Design

Line: 193

                      }

        @Override
        public void run(long n) {
            long emitted = 0L;
            Iterator<T> iterator = this.iterator;
            Subscriber<? super T> downstream = this.downstream;

            for (;;) {

            

Reported by PMD.

Avoid reassigning parameters such as 'n'
Design

Line: 193

                      }

        @Override
        public void run(long n) {
            long emitted = 0L;
            Iterator<T> iterator = this.iterator;
            Subscriber<? super T> downstream = this.downstream;

            for (;;) {

            

Reported by PMD.

Avoid reassigning parameters such as 'n'
Design

Line: 261

                      }

        @Override
        public void run(long n) {
            long emitted = 0L;
            Iterator<T> iterator = this.iterator;
            ConditionalSubscriber<? super T> downstream = this.downstream;

            for (;;) {

            

Reported by PMD.

Avoid reassigning parameters such as 'n'
Design

Line: 261

                      }

        @Override
        public void run(long n) {
            long emitted = 0L;
            Iterator<T> iterator = this.iterator;
            ConditionalSubscriber<? super T> downstream = this.downstream;

            for (;;) {

            

Reported by PMD.

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

Line: 38

               */
public final class FlowableFromStream<T> extends Flowable<T> {

    final Stream<T> stream;

    public FlowableFromStream(Stream<T> stream) {
        this.stream = stream;
    }


            

Reported by PMD.

A catch statement should never catch throwable since it includes errors.
Error

Line: 65

                              closeSafely(stream);
                return;
            }
        } catch (Throwable ex) {
            Exceptions.throwIfFatal(ex);
            EmptySubscription.error(ex, s);
            closeSafely(stream);
            return;
        }

            

Reported by PMD.

A catch statement should never catch throwable since it includes errors.
Error

Line: 82

                  static void closeSafely(AutoCloseable c) {
        try {
            c.close();
        } catch (Throwable ex) {
            Exceptions.throwIfFatal(ex);
            RxJavaPlugins.onError(ex);
        }
    }


            

Reported by PMD.

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

Line: 92

              
        private static final long serialVersionUID = -9082954702547571853L;

        Iterator<T> iterator;

        AutoCloseable closeable;

        volatile boolean cancelled;


            

Reported by PMD.

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

Line: 94

              
        Iterator<T> iterator;

        AutoCloseable closeable;

        volatile boolean cancelled;

        boolean once;


            

Reported by PMD.

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

Line: 96

              
        AutoCloseable closeable;

        volatile boolean cancelled;

        boolean once;

        AbstractStreamSubscription(Iterator<T> iterator, AutoCloseable closeable) {
            this.iterator = iterator;

            

Reported by PMD.

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

Line: 27

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

public class MaybeOnErrorXTest extends RxJavaTest {

    @Test
    public void onErrorReturnConst() {
        Maybe.error(new TestException())
        .onErrorReturnItem(1)

            

Reported by PMD.

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

Line: 30

              public class MaybeOnErrorXTest extends RxJavaTest {

    @Test
    public void onErrorReturnConst() {
        Maybe.error(new TestException())
        .onErrorReturnItem(1)
        .test()
        .assertResult(1);
    }

            

Reported by PMD.

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

Line: 38

                  }

    @Test
    public void onErrorReturn() {
        Maybe.error(new TestException())
        .onErrorReturn(Functions.justFunction(1))
        .test()
        .assertResult(1);
    }

            

Reported by PMD.

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

Line: 46

                  }

    @Test
    public void onErrorComplete() {
        Maybe.error(new TestException())
        .onErrorComplete()
        .test()
        .assertResult();
    }

            

Reported by PMD.

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

Line: 54

                  }

    @Test
    public void onErrorCompleteTrue() {
        Maybe.error(new TestException())
        .onErrorComplete(Functions.alwaysTrue())
        .test()
        .assertResult();
    }

            

Reported by PMD.

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

Line: 62

                  }

    @Test
    public void onErrorCompleteFalse() {
        Maybe.error(new TestException())
        .onErrorComplete(Functions.alwaysFalse())
        .test()
        .assertFailure(TestException.class);
    }

            

Reported by PMD.

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

Line: 70

                  }

    @Test
    public void onErrorReturnFunctionThrows() {
        TestHelper.assertCompositeExceptions(Maybe.error(new TestException())
        .onErrorReturn(new Function<Throwable, Object>() {
            @Override
            public Object apply(Throwable v) throws Exception {
                throw new IOException();

            

Reported by PMD.

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

Line: 82

                  }

    @Test
    public void onErrorCompletePredicateThrows() {
        TestHelper.assertCompositeExceptions(Maybe.error(new TestException())
        .onErrorComplete(new Predicate<Throwable>() {
            @Override
            public boolean test(Throwable v) throws Exception {
                throw new IOException();

            

Reported by PMD.

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

Line: 94

                  }

    @Test
    public void onErrorResumeNext() {
        Maybe.error(new TestException())
        .onErrorResumeNext(Functions.justFunction(Maybe.just(1)))
        .test()
        .assertResult(1);
    }

            

Reported by PMD.

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

Line: 102

                  }

    @Test
    public void onErrorResumeNextFunctionThrows() {
        TestHelper.assertCompositeExceptions(Maybe.error(new TestException())
        .onErrorResumeNext(new Function<Throwable, Maybe<Object>>() {
            @Override
            public Maybe<Object> apply(Throwable v) throws Exception {
                throw new IOException();

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/operators/parallel/ParallelSortedJoin.java
42 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 38

               */
public final class ParallelSortedJoin<T> extends Flowable<T> {

    final ParallelFlowable<List<T>> source;

    final Comparator<? super T> comparator;

    public ParallelSortedJoin(ParallelFlowable<List<T>> source, Comparator<? super T> comparator) {
        this.source = source;

            

Reported by PMD.

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

Line: 40

              
    final ParallelFlowable<List<T>> source;

    final Comparator<? super T> comparator;

    public ParallelSortedJoin(ParallelFlowable<List<T>> source, Comparator<? super T> comparator) {
        this.source = source;
        this.comparator = comparator;
    }

            

Reported by PMD.

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

Line: 55

                      source.subscribe(parent.subscribers);
    }

    static final class SortedJoinSubscription<T>
    extends AtomicInteger
    implements Subscription {

        private static final long serialVersionUID = 3481980673745556697L;


            

Reported by PMD.

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

Line: 55

                      source.subscribe(parent.subscribers);
    }

    static final class SortedJoinSubscription<T>
    extends AtomicInteger
    implements Subscription {

        private static final long serialVersionUID = 3481980673745556697L;


            

Reported by PMD.

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

Line: 61

              
        private static final long serialVersionUID = 3481980673745556697L;

        final Subscriber<? super T> downstream;

        final SortedJoinInnerSubscriber<T>[] subscribers;

        final List<T>[] lists;


            

Reported by PMD.

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

Line: 63

              
        final Subscriber<? super T> downstream;

        final SortedJoinInnerSubscriber<T>[] subscribers;

        final List<T>[] lists;

        final int[] indexes;


            

Reported by PMD.

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

Line: 65

              
        final SortedJoinInnerSubscriber<T>[] subscribers;

        final List<T>[] lists;

        final int[] indexes;

        final Comparator<? super T> comparator;


            

Reported by PMD.

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

Line: 67

              
        final List<T>[] lists;

        final int[] indexes;

        final Comparator<? super T> comparator;

        final AtomicLong requested = new AtomicLong();


            

Reported by PMD.

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

Line: 69

              
        final int[] indexes;

        final Comparator<? super T> comparator;

        final AtomicLong requested = new AtomicLong();

        volatile boolean cancelled;


            

Reported by PMD.

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

Line: 71

              
        final Comparator<? super T> comparator;

        final AtomicLong requested = new AtomicLong();

        volatile boolean cancelled;

        final AtomicInteger remaining = new AtomicInteger();


            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapSingle.java
42 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 40

               */
public final class FlowableConcatMapSingle<T, R> extends Flowable<R> {

    final Flowable<T> source;

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

    final ErrorMode errorMode;


            

Reported by PMD.

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

Line: 42

              
    final Flowable<T> source;

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

    final ErrorMode errorMode;

    final int prefetch;


            

Reported by PMD.

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

Line: 44

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

    final ErrorMode errorMode;

    final int prefetch;

    public FlowableConcatMapSingle(Flowable<T> source,
            Function<? super T, ? extends SingleSource<? extends R>> mapper,

            

Reported by PMD.

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

Line: 46

              
    final ErrorMode errorMode;

    final int prefetch;

    public FlowableConcatMapSingle(Flowable<T> source,
            Function<? super T, ? extends SingleSource<? extends R>> mapper,
                    ErrorMode errorMode, int prefetch) {
        this.source = source;

            

Reported by PMD.

The class 'ConcatMapSingleSubscriber' has a Standard Cyclomatic Complexity of 3 (Highest = 17).
Design

Line: 62

                      source.subscribe(new ConcatMapSingleSubscriber<>(s, mapper, prefetch, errorMode));
    }

    static final class ConcatMapSingleSubscriber<T, R>
    extends ConcatMapXMainSubscriber<T> implements Subscription {

        private static final long serialVersionUID = -9140123220065488293L;

        final Subscriber<? super R> downstream;

            

Reported by PMD.

The class 'ConcatMapSingleSubscriber' has a Modified Cyclomatic Complexity of 3 (Highest = 17).
Design

Line: 62

                      source.subscribe(new ConcatMapSingleSubscriber<>(s, mapper, prefetch, errorMode));
    }

    static final class ConcatMapSingleSubscriber<T, R>
    extends ConcatMapXMainSubscriber<T> implements Subscription {

        private static final long serialVersionUID = -9140123220065488293L;

        final Subscriber<? super R> downstream;

            

Reported by PMD.

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

Line: 67

              
        private static final long serialVersionUID = -9140123220065488293L;

        final Subscriber<? super R> downstream;

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

        final AtomicLong requested;


            

Reported by PMD.

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

Line: 69

              
        final Subscriber<? super R> downstream;

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

        final AtomicLong requested;

        final ConcatMapSingleObserver<R> inner;


            

Reported by PMD.

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

Line: 71

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

        final AtomicLong requested;

        final ConcatMapSingleObserver<R> inner;

        long emitted;


            

Reported by PMD.

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

Line: 73

              
        final AtomicLong requested;

        final ConcatMapSingleObserver<R> inner;

        long emitted;

        int consumed;


            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableConcatMapMaybe.java
42 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 40

               */
public final class FlowableConcatMapMaybe<T, R> extends Flowable<R> {

    final Flowable<T> source;

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

    final ErrorMode errorMode;


            

Reported by PMD.

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

Line: 42

              
    final Flowable<T> source;

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

    final ErrorMode errorMode;

    final int prefetch;


            

Reported by PMD.

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

Line: 44

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

    final ErrorMode errorMode;

    final int prefetch;

    public FlowableConcatMapMaybe(Flowable<T> source,
            Function<? super T, ? extends MaybeSource<? extends R>> mapper,

            

Reported by PMD.

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

Line: 46

              
    final ErrorMode errorMode;

    final int prefetch;

    public FlowableConcatMapMaybe(Flowable<T> source,
            Function<? super T, ? extends MaybeSource<? extends R>> mapper,
                    ErrorMode errorMode, int prefetch) {
        this.source = source;

            

Reported by PMD.

The class 'ConcatMapMaybeSubscriber' has a Standard Cyclomatic Complexity of 3 (Highest = 17).
Design

Line: 62

                      source.subscribe(new ConcatMapMaybeSubscriber<>(s, mapper, prefetch, errorMode));
    }

    static final class ConcatMapMaybeSubscriber<T, R>
    extends ConcatMapXMainSubscriber<T> implements Subscription {

        private static final long serialVersionUID = -9140123220065488293L;

        final Subscriber<? super R> downstream;

            

Reported by PMD.

The class 'ConcatMapMaybeSubscriber' has a Modified Cyclomatic Complexity of 3 (Highest = 17).
Design

Line: 62

                      source.subscribe(new ConcatMapMaybeSubscriber<>(s, mapper, prefetch, errorMode));
    }

    static final class ConcatMapMaybeSubscriber<T, R>
    extends ConcatMapXMainSubscriber<T> implements Subscription {

        private static final long serialVersionUID = -9140123220065488293L;

        final Subscriber<? super R> downstream;

            

Reported by PMD.

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

Line: 67

              
        private static final long serialVersionUID = -9140123220065488293L;

        final Subscriber<? super R> downstream;

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

        final AtomicLong requested;


            

Reported by PMD.

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

Line: 69

              
        final Subscriber<? super R> downstream;

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

        final AtomicLong requested;

        final ConcatMapMaybeObserver<R> inner;


            

Reported by PMD.

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

Line: 71

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

        final AtomicLong requested;

        final ConcatMapMaybeObserver<R> inner;

        long emitted;


            

Reported by PMD.

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

Line: 73

              
        final AtomicLong requested;

        final ConcatMapMaybeObserver<R> inner;

        long emitted;

        int consumed;


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableCreateTest.java
42 issues
This class has too many methods, consider refactoring it.
Design

Line: 30

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

public class CompletableCreateTest extends RxJavaTest {

    @Test
    public void basic() {
        List<Throwable> errors = TestHelper.trackPluginErrors();
        try {

            

Reported by PMD.

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

Line: 51

                          .test()
            .assertResult();

            assertTrue(d.isDisposed());

            TestHelper.assertUndeliverable(errors, 0, TestException.class);
        } finally {
            RxJavaPlugins.reset();
        }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 51

                          .test()
            .assertResult();

            assertTrue(d.isDisposed());

            TestHelper.assertUndeliverable(errors, 0, TestException.class);
        } finally {
            RxJavaPlugins.reset();
        }

            

Reported by PMD.

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

Line: 60

                  }

    @Test
    public void basicWithCancellable() {
        List<Throwable> errors = TestHelper.trackPluginErrors();
        try {
            final Disposable d1 = Disposable.empty();
            final Disposable d2 = Disposable.empty();


            

Reported by PMD.

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

Line: 85

                          .test()
            .assertResult();

            assertTrue(d1.isDisposed());
            assertTrue(d2.isDisposed());

            TestHelper.assertUndeliverable(errors, 0, TestException.class);
        } finally {
            RxJavaPlugins.reset();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 85

                          .test()
            .assertResult();

            assertTrue(d1.isDisposed());
            assertTrue(d2.isDisposed());

            TestHelper.assertUndeliverable(errors, 0, TestException.class);
        } finally {
            RxJavaPlugins.reset();

            

Reported by PMD.

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

Line: 86

                          .assertResult();

            assertTrue(d1.isDisposed());
            assertTrue(d2.isDisposed());

            TestHelper.assertUndeliverable(errors, 0, TestException.class);
        } finally {
            RxJavaPlugins.reset();
        }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 86

                          .assertResult();

            assertTrue(d1.isDisposed());
            assertTrue(d2.isDisposed());

            TestHelper.assertUndeliverable(errors, 0, TestException.class);
        } finally {
            RxJavaPlugins.reset();
        }

            

Reported by PMD.

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

Line: 113

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

            assertTrue(d.isDisposed());

            TestHelper.assertUndeliverable(errors, 0, TestException.class, "second");
        } finally {
            RxJavaPlugins.reset();
        }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 113

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

            assertTrue(d.isDisposed());

            TestHelper.assertUndeliverable(errors, 0, TestException.class, "second");
        } finally {
            RxJavaPlugins.reset();
        }

            

Reported by PMD.

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

Line: 31

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

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

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

            

Reported by PMD.

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

Line: 36

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

        Flowable<Long> source = Flowable.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: 38

              
        Flowable<Long> source = Flowable.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: 40

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

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

        Flowable<Long> source = Flowable.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: 62

              
        Flowable<Long> source = Flowable.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: 86

                  public void empty() {
        Flowable<Long> source = Flowable.<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: 88

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

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

        Flowable<Long> source = Flowable.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: 101

              
        Flowable<Long> source = Flowable.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/exceptions/ExceptionsTest.java
42 issues
Avoid throwing raw exception types.
Design

Line: 47

              
            @Override
            public void accept(Integer t1) {
                throw new RuntimeException("hello");
            }

        });

        TestHelper.assertError(errors, 0, RuntimeException.class);

            

Reported by PMD.

The class 'ExceptionsTest' has a Modified Cyclomatic Complexity of 3 (Highest = 10).
Design

Line: 32

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

public class ExceptionsTest extends RxJavaTest {

    @Test
    public void constructorShouldBePrivate() {
        TestHelper.checkUtilityClass(ExceptionHelper.class);
    }

            

Reported by PMD.

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 ExceptionsTest extends RxJavaTest {

    @Test
    public void constructorShouldBePrivate() {
        TestHelper.checkUtilityClass(ExceptionHelper.class);
    }

            

Reported by PMD.

The class 'ExceptionsTest' has a Standard Cyclomatic Complexity of 3 (Highest = 10).
Design

Line: 32

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

public class ExceptionsTest extends RxJavaTest {

    @Test
    public void constructorShouldBePrivate() {
        TestHelper.checkUtilityClass(ExceptionHelper.class);
    }

            

Reported by PMD.

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

Line: 35

              public class ExceptionsTest extends RxJavaTest {

    @Test
    public void constructorShouldBePrivate() {
        TestHelper.checkUtilityClass(ExceptionHelper.class);
    }

    @Test
    public void onErrorNotImplementedIsThrown() {

            

Reported by PMD.

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

Line: 53

                      });

        TestHelper.assertError(errors, 0, RuntimeException.class);
        assertTrue(errors.get(0).toString(), errors.get(0).getMessage().contains("hello"));
        RxJavaPlugins.reset();
    }

    @Test
    public void stackOverflowWouldOccur() {

            

Reported by PMD.

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

Line: 53

                      });

        TestHelper.assertError(errors, 0, RuntimeException.class);
        assertTrue(errors.get(0).toString(), errors.get(0).getMessage().contains("hello"));
        RxJavaPlugins.reset();
    }

    @Test
    public void stackOverflowWouldOccur() {

            

Reported by PMD.

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

Line: 53

                      });

        TestHelper.assertError(errors, 0, RuntimeException.class);
        assertTrue(errors.get(0).toString(), errors.get(0).getMessage().contains("hello"));
        RxJavaPlugins.reset();
    }

    @Test
    public void stackOverflowWouldOccur() {

            

Reported by PMD.

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

Line: 53

                      });

        TestHelper.assertError(errors, 0, RuntimeException.class);
        assertTrue(errors.get(0).toString(), errors.get(0).getMessage().contains("hello"));
        RxJavaPlugins.reset();
    }

    @Test
    public void stackOverflowWouldOccur() {

            

Reported by PMD.

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

Line: 53

                      });

        TestHelper.assertError(errors, 0, RuntimeException.class);
        assertTrue(errors.get(0).toString(), errors.get(0).getMessage().contains("hello"));
        RxJavaPlugins.reset();
    }

    @Test
    public void stackOverflowWouldOccur() {

            

Reported by PMD.