The following issues were found

src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleDoFinallyTest.java
15 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 31

              
public class SingleDoFinallyTest extends RxJavaTest implements Action {

    int calls;

    @Override
    public void run() throws Exception {
        calls++;
    }

            

Reported by PMD.

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

Line: 40

              
    @Test
    public void normalJust() {
        Single.just(1)
        .doFinally(this)
        .test()
        .assertResult(1);

        assertEquals(1, calls);

            

Reported by PMD.

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

Line: 40

              
    @Test
    public void normalJust() {
        Single.just(1)
        .doFinally(this)
        .test()
        .assertResult(1);

        assertEquals(1, calls);

            

Reported by PMD.

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

Line: 40

              
    @Test
    public void normalJust() {
        Single.just(1)
        .doFinally(this)
        .test()
        .assertResult(1);

        assertEquals(1, calls);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 45

                      .test()
        .assertResult(1);

        assertEquals(1, calls);
    }

    @Test
    public void normalError() {
        Single.error(new TestException())

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 55

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

        assertEquals(1, calls);
    }

    @Test
    public void doubleOnSubscribe() {
        TestHelper.checkDoubleOnSubscribeSingle(new Function<Single<Object>, Single<Object>>() {

            

Reported by PMD.

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

Line: 59

                  }

    @Test
    public void doubleOnSubscribe() {
        TestHelper.checkDoubleOnSubscribeSingle(new Function<Single<Object>, Single<Object>>() {
            @Override
            public Single<Object> apply(Single<Object> f) throws Exception {
                return f.doFinally(SingleDoFinallyTest.this);
            }

            

Reported by PMD.

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

Line: 69

                  }

    @Test
    public void actionThrows() {
        List<Throwable> errors = TestHelper.trackPluginErrors();
        try {
            Single.just(1)
            .doFinally(new Action() {
                @Override

            

Reported by PMD.

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

Line: 90

                  }

    @Test
    public void disposed() {
        TestHelper.checkDisposed(PublishSubject.create().singleOrError().doFinally(this));
    }
}

            

Reported by PMD.

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

Line: 91

              
    @Test
    public void disposed() {
        TestHelper.checkDisposed(PublishSubject.create().singleOrError().doFinally(this));
    }
}

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/processors/PublishProcessor.java
15 issues
This class has too many methods, consider refactoring it.
Design

Line: 110

               * @param <T> the value type multicasted to Subscribers.
 * @see MulticastProcessor
 */
public final class PublishProcessor<@NonNull T> extends FlowableProcessor<T> {
    /** The terminated indicator for the subscribers array. */
    @SuppressWarnings("rawtypes")
    static final PublishSubscription[] TERMINATED = new PublishSubscription[0];
    /** An empty subscribers array to avoid allocating it all the time. */
    @SuppressWarnings("rawtypes")

            

Reported by PMD.

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

Line: 119

                  static final PublishSubscription[] EMPTY = new PublishSubscription[0];

    /** The array of currently subscribed subscribers. */
    final AtomicReference<PublishSubscription<T>[]> subscribers;

    /** The error, write before terminating and read after checking subscribers. */
    Throwable error;

    /**

            

Reported by PMD.

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

Line: 122

                  final AtomicReference<PublishSubscription<T>[]> subscribers;

    /** The error, write before terminating and read after checking subscribers. */
    Throwable error;

    /**
     * Constructs a PublishProcessor.
     * @param <T> the value type
     * @return the new PublishProcessor

            

Reported by PMD.

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

Line: 139

                   * Constructs a PublishProcessor.
     * @since 2.0
     */
    @SuppressWarnings("unchecked")
    PublishProcessor() {
        subscribers = new AtomicReference<>(EMPTY);
    }

    @Override

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 179

              
            int n = a.length;
            @SuppressWarnings("unchecked")
            PublishSubscription<T>[] b = new PublishSubscription[n + 1];
            System.arraycopy(a, 0, b, 0, n);
            b[n] = ps;

            if (subscribers.compareAndSet(a, b)) {
                return true;

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 216

              
            PublishSubscription<T>[] b;

            if (n == 1) {
                b = EMPTY;
            } else {
                b = new PublishSubscription[n - 1];
                System.arraycopy(a, 0, b, 0, j);
                System.arraycopy(a, j + 1, b, j, n - j - 1);

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 219

                          if (n == 1) {
                b = EMPTY;
            } else {
                b = new PublishSubscription[n - 1];
                System.arraycopy(a, 0, b, 0, j);
                System.arraycopy(a, j + 1, b, j, n - j - 1);
            }
            if (subscribers.compareAndSet(a, b)) {
                return;

            

Reported by PMD.

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

Line: 309

                  @Override
    @CheckReturnValue
    public boolean hasSubscribers() {
        return subscribers.get().length != 0;
    }

    @Override
    @Nullable
    @CheckReturnValue

            

Reported by PMD.

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

Line: 344

              
        private static final long serialVersionUID = 3562861878281475070L;
        /** The actual subscriber. */
        final Subscriber<? super T> downstream;
        /** The parent processor servicing this subscriber. */
        final PublishProcessor<T> parent;

        /**
         * Constructs a PublishSubscriber, wraps the actual subscriber and the state.

            

Reported by PMD.

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

Line: 346

                      /** The actual subscriber. */
        final Subscriber<? super T> downstream;
        /** The parent processor servicing this subscriber. */
        final PublishProcessor<T> parent;

        /**
         * Constructs a PublishSubscriber, wraps the actual subscriber and the state.
         * @param actual the actual subscriber
         * @param parent the parent PublishProcessor

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableRepeatWhenTest.java
15 issues
JUnit assertions should include a message
Design

Line: 50

                      })
        .subscribe();

        assertEquals(4, counter[0]);
    }
}

            

Reported by PMD.

Avoid unused imports such as 'io.reactivex.rxjava3.core'
Design

Line: 21

              import org.junit.Test;
import org.reactivestreams.Publisher;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.functions.*;

public class CompletableRepeatWhenTest extends RxJavaTest {
    @Test
    public void whenCounted() {

            

Reported by PMD.

Avoid unused imports such as 'io.reactivex.rxjava3.functions'
Design

Line: 22

              import org.reactivestreams.Publisher;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.functions.*;

public class CompletableRepeatWhenTest extends RxJavaTest {
    @Test
    public void whenCounted() {


            

Reported by PMD.

Found 'DD'-anomaly for variable 'counter' (lines '28'-'33').
Error

Line: 28

                  @Test
    public void whenCounted() {

        final int[] counter = { 0 };

        Completable.fromAction(new Action() {
            @Override
            public void run() throws Exception {
                counter[0]++;

            

Reported by PMD.

Found 'DD'-anomaly for variable 'counter' (lines '28'-'33').
Error

Line: 28

                  @Test
    public void whenCounted() {

        final int[] counter = { 0 };

        Completable.fromAction(new Action() {
            @Override
            public void run() throws Exception {
                counter[0]++;

            

Reported by PMD.

Found 'DD'-anomaly for variable 'counter' (lines '28'-'33').
Error

Line: 28

                  @Test
    public void whenCounted() {

        final int[] counter = { 0 };

        Completable.fromAction(new Action() {
            @Override
            public void run() throws Exception {
                counter[0]++;

            

Reported by PMD.

Found 'DD'-anomaly for variable 'counter' (lines '28'-'33').
Error

Line: 28

                  @Test
    public void whenCounted() {

        final int[] counter = { 0 };

        Completable.fromAction(new Action() {
            @Override
            public void run() throws Exception {
                counter[0]++;

            

Reported by PMD.

Found 'DU'-anomaly for variable 'counter' (lines '33'-'51').
Error

Line: 33

                      Completable.fromAction(new Action() {
            @Override
            public void run() throws Exception {
                counter[0]++;
            }
        })
        .repeatWhen(new Function<Flowable<Object>, Publisher<Object>>() {
            @Override
            public Publisher<Object> apply(Flowable<Object> f) throws Exception {

            

Reported by PMD.

Found 'DU'-anomaly for variable 'counter' (lines '33'-'51').
Error

Line: 33

                      Completable.fromAction(new Action() {
            @Override
            public void run() throws Exception {
                counter[0]++;
            }
        })
        .repeatWhen(new Function<Flowable<Object>, Publisher<Object>>() {
            @Override
            public Publisher<Object> apply(Flowable<Object> f) throws Exception {

            

Reported by PMD.

Found 'DU'-anomaly for variable 'counter' (lines '33'-'51').
Error

Line: 33

                      Completable.fromAction(new Action() {
            @Override
            public void run() throws Exception {
                counter[0]++;
            }
        })
        .repeatWhen(new Function<Flowable<Object>, Publisher<Object>>() {
            @Override
            public Publisher<Object> apply(Flowable<Object> f) throws Exception {

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableDoFinallyTest.java
15 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 31

              
public class CompletableDoFinallyTest extends RxJavaTest implements Action {

    int calls;

    @Override
    public void run() throws Exception {
        calls++;
    }

            

Reported by PMD.

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

Line: 40

              
    @Test
    public void normalEmpty() {
        Completable.complete()
        .doFinally(this)
        .test()
        .assertResult();

        assertEquals(1, calls);

            

Reported by PMD.

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

Line: 40

              
    @Test
    public void normalEmpty() {
        Completable.complete()
        .doFinally(this)
        .test()
        .assertResult();

        assertEquals(1, calls);

            

Reported by PMD.

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

Line: 40

              
    @Test
    public void normalEmpty() {
        Completable.complete()
        .doFinally(this)
        .test()
        .assertResult();

        assertEquals(1, calls);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 45

                      .test()
        .assertResult();

        assertEquals(1, calls);
    }

    @Test
    public void normalError() {
        Completable.error(new TestException())

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 55

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

        assertEquals(1, calls);
    }

    @Test
    public void doubleOnSubscribe() {
        TestHelper.checkDoubleOnSubscribeCompletable(new Function<Completable, Completable>() {

            

Reported by PMD.

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

Line: 59

                  }

    @Test
    public void doubleOnSubscribe() {
        TestHelper.checkDoubleOnSubscribeCompletable(new Function<Completable, Completable>() {
            @Override
            public Completable apply(Completable f) throws Exception {
                return f.doFinally(CompletableDoFinallyTest.this);
            }

            

Reported by PMD.

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

Line: 69

                  }

    @Test
    public void actionThrows() {
        List<Throwable> errors = TestHelper.trackPluginErrors();
        try {
            Completable.complete()
            .doFinally(new Action() {
                @Override

            

Reported by PMD.

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

Line: 90

                  }

    @Test
    public void disposed() {
        TestHelper.checkDisposed(PublishSubject.create().ignoreElements().doFinally(this));
    }
}

            

Reported by PMD.

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

Line: 91

              
    @Test
    public void disposed() {
        TestHelper.checkDisposed(PublishSubject.create().ignoreElements().doFinally(this));
    }
}

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/subjects/CompletableSubject.java
15 issues
This class has too many methods, consider refactoring it.
Design

Line: 87

               * <p>History: 2.0.5 - experimental
 * @since 2.1
 */
public final class CompletableSubject extends Completable implements CompletableObserver {

    final AtomicReference<CompletableDisposable[]> observers;

    static final CompletableDisposable[] EMPTY = new CompletableDisposable[0];


            

Reported by PMD.

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

Line: 89

               */
public final class CompletableSubject extends Completable implements CompletableObserver {

    final AtomicReference<CompletableDisposable[]> observers;

    static final CompletableDisposable[] EMPTY = new CompletableDisposable[0];

    static final CompletableDisposable[] TERMINATED = new CompletableDisposable[0];


            

Reported by PMD.

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

Line: 95

              
    static final CompletableDisposable[] TERMINATED = new CompletableDisposable[0];

    final AtomicBoolean once;
    Throwable error;

    /**
     * Creates a fresh CompletableSubject.
     * @return the new CompletableSubject instance

            

Reported by PMD.

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

Line: 96

                  static final CompletableDisposable[] TERMINATED = new CompletableDisposable[0];

    final AtomicBoolean once;
    Throwable error;

    /**
     * Creates a fresh CompletableSubject.
     * @return the new CompletableSubject instance
     */

            

Reported by PMD.

Potential violation of Law of Demeter (static property access)
Design

Line: 126

                      if (once.compareAndSet(false, true)) {
            this.error = e;
            for (CompletableDisposable md : observers.getAndSet(TERMINATED)) {
                md.downstream.onError(e);
            }
        } else {
            RxJavaPlugins.onError(e);
        }
    }

            

Reported by PMD.

Potential violation of Law of Demeter (static property access)
Design

Line: 137

                  public void onComplete() {
        if (once.compareAndSet(false, true)) {
            for (CompletableDisposable md : observers.getAndSet(TERMINATED)) {
                md.downstream.onComplete();
            }
        }
    }

    @Override

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 169

              
            int n = a.length;

            CompletableDisposable[] b = new CompletableDisposable[n + 1];
            System.arraycopy(a, 0, b, 0, n);
            b[n] = inner;
            if (observers.compareAndSet(a, b)) {
                return true;
            }

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 199

                              return;
            }
            CompletableDisposable[] b;
            if (n == 1) {
                b = EMPTY;
            } else {
                b = new CompletableDisposable[n - 1];
                System.arraycopy(a, 0, b, 0, j);
                System.arraycopy(a, j + 1, b, j, n - j - 1);

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 202

                          if (n == 1) {
                b = EMPTY;
            } else {
                b = new CompletableDisposable[n - 1];
                System.arraycopy(a, 0, b, 0, j);
                System.arraycopy(a, j + 1, b, j, n - j - 1);
            }

            if (observers.compareAndSet(a, b)) {

            

Reported by PMD.

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

Line: 246

                   * @return true if this CompletableSubject has observers
     */
    public boolean hasObservers() {
        return observers.get().length != 0;
    }

    /**
     * Returns the number of current observers.
     * @return the number of current observers

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/schedulers/TestScheduler.java
15 issues
Avoid reassigning parameters such as 'run'
Design

Line: 202

              
        @NonNull
        @Override
        public Disposable schedule(@NonNull Runnable run, long delayTime, @NonNull TimeUnit unit) {
            if (disposed) {
                return EmptyDisposable.INSTANCE;
            }
            if (useOnScheduleHook) {
                run = RxJavaPlugins.onSchedule(run);

            

Reported by PMD.

Avoid reassigning parameters such as 'run'
Design

Line: 217

              
        @NonNull
        @Override
        public Disposable schedule(@NonNull Runnable run) {
            if (disposed) {
                return EmptyDisposable.INSTANCE;
            }
            if (useOnScheduleHook) {
                run = RxJavaPlugins.onSchedule(run);

            

Reported by PMD.

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

Line: 37

               */
public final class TestScheduler extends Scheduler {
    /** The ordered queue for the runnable tasks. */
    final Queue<TimedRunnable> queue = new PriorityBlockingQueue<>(11);
    /** Use the {@link RxJavaPlugins#onSchedule(Runnable)} hook when scheduling tasks. */
    final boolean useOnScheduleHook;
    /** The per-scheduler global order counter. */
    long counter;
    // Storing time in nanoseconds internally.

            

Reported by PMD.

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

Line: 39

                  /** The ordered queue for the runnable tasks. */
    final Queue<TimedRunnable> queue = new PriorityBlockingQueue<>(11);
    /** Use the {@link RxJavaPlugins#onSchedule(Runnable)} hook when scheduling tasks. */
    final boolean useOnScheduleHook;
    /** The per-scheduler global order counter. */
    long counter;
    // Storing time in nanoseconds internally.
    volatile long time;


            

Reported by PMD.

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

Line: 41

                  /** Use the {@link RxJavaPlugins#onSchedule(Runnable)} hook when scheduling tasks. */
    final boolean useOnScheduleHook;
    /** The per-scheduler global order counter. */
    long counter;
    // Storing time in nanoseconds internally.
    volatile long time;

    /**
     * Creates a new TestScheduler with initial virtual time of zero.

            

Reported by PMD.

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

Line: 43

                  /** The per-scheduler global order counter. */
    long counter;
    // Storing time in nanoseconds internally.
    volatile long time;

    /**
     * Creates a new TestScheduler with initial virtual time of zero.
     */
    public TestScheduler() {

            

Reported by PMD.

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

Line: 98

              
    static final class TimedRunnable implements Comparable<TimedRunnable> {

        final long time;
        final Runnable run;
        final TestWorker scheduler;
        final long count; // for differentiating tasks at same time

        TimedRunnable(TestWorker scheduler, long time, Runnable run, long count) {

            

Reported by PMD.

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

Line: 99

                  static final class TimedRunnable implements Comparable<TimedRunnable> {

        final long time;
        final Runnable run;
        final TestWorker scheduler;
        final long count; // for differentiating tasks at same time

        TimedRunnable(TestWorker scheduler, long time, Runnable run, long count) {
            this.time = time;

            

Reported by PMD.

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

Line: 100

              
        final long time;
        final Runnable run;
        final TestWorker scheduler;
        final long count; // for differentiating tasks at same time

        TimedRunnable(TestWorker scheduler, long time, Runnable run, long count) {
            this.time = time;
            this.run = run;

            

Reported by PMD.

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

Line: 101

                      final long time;
        final Runnable run;
        final TestWorker scheduler;
        final long count; // for differentiating tasks at same time

        TimedRunnable(TestWorker scheduler, long time, Runnable run, long count) {
            this.time = time;
            this.run = run;
            this.scheduler = scheduler;

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/schedulers/Schedulers.java
15 issues
Field SINGLE has the same name as a method
Error

Line: 50

               */
public final class Schedulers {
    @NonNull
    static final Scheduler SINGLE;

    @NonNull
    static final Scheduler COMPUTATION;

    @NonNull

            

Reported by PMD.

Field COMPUTATION has the same name as a method
Error

Line: 53

                  static final Scheduler SINGLE;

    @NonNull
    static final Scheduler COMPUTATION;

    @NonNull
    static final Scheduler IO;

    @NonNull

            

Reported by PMD.

Field IO has the same name as a method
Error

Line: 56

                  static final Scheduler COMPUTATION;

    @NonNull
    static final Scheduler IO;

    @NonNull
    static final Scheduler TRAMPOLINE;

    @NonNull

            

Reported by PMD.

Field TRAMPOLINE has the same name as a method
Error

Line: 59

                  static final Scheduler IO;

    @NonNull
    static final Scheduler TRAMPOLINE;

    @NonNull
    static final Scheduler NEW_THREAD;

    static final class SingleHolder {

            

Reported by PMD.

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

Line: 568

                   * <p>The operation is idempotent and thread-safe.
     */
    public static void shutdown() {
        computation().shutdown();
        io().shutdown();
        newThread().shutdown();
        single().shutdown();
        trampoline().shutdown();
    }

            

Reported by PMD.

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

Line: 569

                   */
    public static void shutdown() {
        computation().shutdown();
        io().shutdown();
        newThread().shutdown();
        single().shutdown();
        trampoline().shutdown();
    }


            

Reported by PMD.

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

Line: 570

                  public static void shutdown() {
        computation().shutdown();
        io().shutdown();
        newThread().shutdown();
        single().shutdown();
        trampoline().shutdown();
    }

    /**

            

Reported by PMD.

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

Line: 571

                      computation().shutdown();
        io().shutdown();
        newThread().shutdown();
        single().shutdown();
        trampoline().shutdown();
    }

    /**
     * Starts the standard {@link Scheduler}s.

            

Reported by PMD.

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

Line: 572

                      io().shutdown();
        newThread().shutdown();
        single().shutdown();
        trampoline().shutdown();
    }

    /**
     * Starts the standard {@link Scheduler}s.
     * <p>The operation is idempotent and thread-safe.

            

Reported by PMD.

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

Line: 580

                   * <p>The operation is idempotent and thread-safe.
     */
    public static void start() {
        computation().start();
        io().start();
        newThread().start();
        single().start();
        trampoline().start();
    }

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/observers/BlockingFirstObserverTest.java
15 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 27

              public class BlockingFirstObserverTest extends RxJavaTest {

    @Test
    public void firstValueOnly() {
        BlockingFirstObserver<Integer> bf = new BlockingFirstObserver<>();
        Disposable d = Disposable.empty();
        bf.onSubscribe(d);

        bf.onNext(1);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 34

              
        bf.onNext(1);

        assertTrue(d.isDisposed());

        assertEquals(1, bf.value.intValue());
        assertEquals(0, bf.getCount());

        bf.onNext(2);

            

Reported by PMD.

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

Line: 34

              
        bf.onNext(1);

        assertTrue(d.isDisposed());

        assertEquals(1, bf.value.intValue());
        assertEquals(0, bf.getCount());

        bf.onNext(2);

            

Reported by PMD.

Potential violation of Law of Demeter (static property access)
Design

Line: 36

              
        assertTrue(d.isDisposed());

        assertEquals(1, bf.value.intValue());
        assertEquals(0, bf.getCount());

        bf.onNext(2);

        assertEquals(1, bf.value.intValue());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 36

              
        assertTrue(d.isDisposed());

        assertEquals(1, bf.value.intValue());
        assertEquals(0, bf.getCount());

        bf.onNext(2);

        assertEquals(1, bf.value.intValue());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 37

                      assertTrue(d.isDisposed());

        assertEquals(1, bf.value.intValue());
        assertEquals(0, bf.getCount());

        bf.onNext(2);

        assertEquals(1, bf.value.intValue());
        assertEquals(0, bf.getCount());

            

Reported by PMD.

Potential violation of Law of Demeter (static property access)
Design

Line: 41

              
        bf.onNext(2);

        assertEquals(1, bf.value.intValue());
        assertEquals(0, bf.getCount());

        bf.onError(new TestException());
        assertEquals(1, bf.value.intValue());
        assertNull(bf.error);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 41

              
        bf.onNext(2);

        assertEquals(1, bf.value.intValue());
        assertEquals(0, bf.getCount());

        bf.onError(new TestException());
        assertEquals(1, bf.value.intValue());
        assertNull(bf.error);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 42

                      bf.onNext(2);

        assertEquals(1, bf.value.intValue());
        assertEquals(0, bf.getCount());

        bf.onError(new TestException());
        assertEquals(1, bf.value.intValue());
        assertNull(bf.error);
        assertEquals(0, bf.getCount());

            

Reported by PMD.

Potential violation of Law of Demeter (static property access)
Design

Line: 45

                      assertEquals(0, bf.getCount());

        bf.onError(new TestException());
        assertEquals(1, bf.value.intValue());
        assertNull(bf.error);
        assertEquals(0, bf.getCount());
    }
}

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/jdk8/ObservableFromCompletionStageTest.java
15 issues
JUnit tests should include assert() or fail()
Design

Line: 27

              public class ObservableFromCompletionStageTest extends RxJavaTest {

    @Test
    public void syncSuccess() {
        Observable.fromCompletionStage(CompletableFuture.completedFuture(1))
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 28

              
    @Test
    public void syncSuccess() {
        Observable.fromCompletionStage(CompletableFuture.completedFuture(1))
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 28

              
    @Test
    public void syncSuccess() {
        Observable.fromCompletionStage(CompletableFuture.completedFuture(1))
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 34

                  }

    @Test
    public void syncFailure() {
        CompletableFuture<Integer> cf = new CompletableFuture<>();
        cf.completeExceptionally(new TestException());

        Observable.fromCompletionStage(cf)
        .test()

            

Reported by PMD.

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

Line: 38

                      CompletableFuture<Integer> cf = new CompletableFuture<>();
        cf.completeExceptionally(new TestException());

        Observable.fromCompletionStage(cf)
        .test()
        .assertFailure(TestException.class);
    }

    @Test

            

Reported by PMD.

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

Line: 38

                      CompletableFuture<Integer> cf = new CompletableFuture<>();
        cf.completeExceptionally(new TestException());

        Observable.fromCompletionStage(cf)
        .test()
        .assertFailure(TestException.class);
    }

    @Test

            

Reported by PMD.

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

Line: 44

                  }

    @Test
    public void syncNull() {
        Observable.fromCompletionStage(CompletableFuture.<Integer>completedFuture(null))
        .test()
        .assertFailure(NullPointerException.class);
    }


            

Reported by PMD.

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

Line: 45

              
    @Test
    public void syncNull() {
        Observable.fromCompletionStage(CompletableFuture.<Integer>completedFuture(null))
        .test()
        .assertFailure(NullPointerException.class);
    }

    @Test

            

Reported by PMD.

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

Line: 45

              
    @Test
    public void syncNull() {
        Observable.fromCompletionStage(CompletableFuture.<Integer>completedFuture(null))
        .test()
        .assertFailure(NullPointerException.class);
    }

    @Test

            

Reported by PMD.

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

Line: 51

                  }

    @Test
    public void cancel() {
        CompletableFuture<Integer> cf = new CompletableFuture<>();

        TestObserver<Integer> to = Observable.fromCompletionStage(cf)
        .test();


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapNotificationTest.java
15 issues
JUnit tests should include assert() or fail()
Design

Line: 29

              public class MaybeFlatMapNotificationTest extends RxJavaTest {

    @Test
    public void dispose() {
        TestHelper.checkDisposed(Maybe.just(1)
                .flatMap(Functions.justFunction(Maybe.just(1)),
                        Functions.justFunction(Maybe.just(1)), Functions.justSupplier(Maybe.just(1))));
    }


            

Reported by PMD.

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

Line: 30

              
    @Test
    public void dispose() {
        TestHelper.checkDisposed(Maybe.just(1)
                .flatMap(Functions.justFunction(Maybe.just(1)),
                        Functions.justFunction(Maybe.just(1)), Functions.justSupplier(Maybe.just(1))));
    }

    @Test

            

Reported by PMD.

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

Line: 36

                  }

    @Test
    public void doubleOnSubscribe() {
        TestHelper.checkDoubleOnSubscribeMaybe(new Function<Maybe<Integer>, MaybeSource<Integer>>() {
            @Override
            public MaybeSource<Integer> apply(Maybe<Integer> m) throws Exception {
                return m
                        .flatMap(Functions.justFunction(Maybe.just(1)),

            

Reported by PMD.

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

Line: 48

                  }

    @Test
    public void onSuccessNull() {
        Maybe.just(1)
        .flatMap(Functions.justFunction((Maybe<Integer>)null),
                Functions.justFunction(Maybe.just(1)),
                Functions.justSupplier(Maybe.just(1)))
        .test()

            

Reported by PMD.

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

Line: 58

                  }

    @Test
    public void onErrorNull() {
        TestObserverEx<Integer> to = Maybe.<Integer>error(new TestException())
        .flatMap(Functions.justFunction(Maybe.just(1)),
                Functions.justFunction((Maybe<Integer>)null),
                Functions.justSupplier(Maybe.just(1)))
        .to(TestHelper.<Integer>testConsumer())

            

Reported by PMD.

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

Line: 66

                      .to(TestHelper.<Integer>testConsumer())
        .assertFailure(CompositeException.class);

        List<Throwable> ce = TestHelper.compositeList(to.errors().get(0));

        TestHelper.assertError(ce, 0, TestException.class);
        TestHelper.assertError(ce, 1, NullPointerException.class);
    }


            

Reported by PMD.

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

Line: 73

                  }

    @Test
    public void onCompleteNull() {
        Maybe.<Integer>empty()
        .flatMap(Functions.justFunction(Maybe.just(1)),
                Functions.justFunction(Maybe.just(1)),
                Functions.justSupplier((Maybe<Integer>)null))
        .test()

            

Reported by PMD.

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

Line: 83

                  }

    @Test
    public void onSuccessEmpty() {
        Maybe.just(1)
        .flatMap(Functions.justFunction(Maybe.<Integer>empty()),
                Functions.justFunction(Maybe.just(1)),
                Functions.justSupplier(Maybe.just(1)))
        .test()

            

Reported by PMD.

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

Line: 84

              
    @Test
    public void onSuccessEmpty() {
        Maybe.just(1)
        .flatMap(Functions.justFunction(Maybe.<Integer>empty()),
                Functions.justFunction(Maybe.just(1)),
                Functions.justSupplier(Maybe.just(1)))
        .test()
        .assertResult();

            

Reported by PMD.

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

Line: 84

              
    @Test
    public void onSuccessEmpty() {
        Maybe.just(1)
        .flatMap(Functions.justFunction(Maybe.<Integer>empty()),
                Functions.justFunction(Maybe.just(1)),
                Functions.justSupplier(Maybe.just(1)))
        .test()
        .assertResult();

            

Reported by PMD.