The following issues were found

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

Line: 36

              
    private static final TimeUnit TIME_UNIT = TimeUnit.MILLISECONDS;

    private Subscriber<Timed<Integer>> subscriber;

    private TestScheduler testScheduler;
    private PublishProcessor<Integer> processor;
    private Flowable<Timed<Integer>> flowable;


            

Reported by PMD.

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

Line: 38

              
    private Subscriber<Timed<Integer>> subscriber;

    private TestScheduler testScheduler;
    private PublishProcessor<Integer> processor;
    private Flowable<Timed<Integer>> flowable;

    @Before
    public void setUp() {

            

Reported by PMD.

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

Line: 39

                  private Subscriber<Timed<Integer>> subscriber;

    private TestScheduler testScheduler;
    private PublishProcessor<Integer> processor;
    private Flowable<Timed<Integer>> flowable;

    @Before
    public void setUp() {
        subscriber = TestHelper.mockSubscriber();

            

Reported by PMD.

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

Line: 40

              
    private TestScheduler testScheduler;
    private PublishProcessor<Integer> processor;
    private Flowable<Timed<Integer>> flowable;

    @Before
    public void setUp() {
        subscriber = TestHelper.mockSubscriber();
        testScheduler = new TestScheduler();

            

Reported by PMD.

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

Line: 69

                              new Timed<>(2, 2000, TIME_UNIT));
        inOrder.verify(subscriber, times(1)).onNext(
                new Timed<>(3, 3000, TIME_UNIT));
        inOrder.verify(subscriber, times(1)).onComplete();
        inOrder.verifyNoMoreInteractions();
    }

    @Test
    public void timeIntervalDefault() {

            

Reported by PMD.

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

Line: 69

                              new Timed<>(2, 2000, TIME_UNIT));
        inOrder.verify(subscriber, times(1)).onNext(
                new Timed<>(3, 3000, TIME_UNIT));
        inOrder.verify(subscriber, times(1)).onComplete();
        inOrder.verifyNoMoreInteractions();
    }

    @Test
    public void timeIntervalDefault() {

            

Reported by PMD.

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

Line: 70

                      inOrder.verify(subscriber, times(1)).onNext(
                new Timed<>(3, 3000, TIME_UNIT));
        inOrder.verify(subscriber, times(1)).onComplete();
        inOrder.verifyNoMoreInteractions();
    }

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

            

Reported by PMD.

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

Line: 129

              
    @Test
    public void dispose() {
        TestHelper.checkDisposed(Flowable.just(1).timeInterval());
    }

    @Test
    public void error() {
        Flowable.error(new TestException())

            

Reported by PMD.

Avoid unused imports such as 'org.mockito.Mockito'
Design

Line: 16

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

import static org.mockito.Mockito.*;

import java.util.concurrent.TimeUnit;

import org.junit.*;
import org.mockito.InOrder;

            

Reported by PMD.

Avoid unused imports such as 'org.junit'
Design

Line: 20

              
import java.util.concurrent.TimeUnit;

import org.junit.*;
import org.mockito.InOrder;
import org.reactivestreams.*;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.TestException;

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeConcatMapSingleTest.java
13 issues
Avoid throwing raw exception types.
Design

Line: 71

                  public void flatMapSingleElementValueErrorThrown() {
        Maybe.just(1).concatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override public SingleSource<Integer> apply(final Integer integer) throws Exception {
                throw new RuntimeException("something went terribly wrong!");
            }
        })
            .to(TestHelper.<Integer>testConsumer())
            .assertNoValues()
            .assertError(RuntimeException.class)

            

Reported by PMD.

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

Line: 25

              
public class MaybeConcatMapSingleTest extends RxJavaTest {
    @Test
    public void flatMapSingleElementValue() {
        Maybe.just(1).concatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override public SingleSource<Integer> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Single.just(2);
                }

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 28

                  public void flatMapSingleElementValue() {
        Maybe.just(1).concatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override public SingleSource<Integer> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Single.just(2);
                }

                return Single.just(1);
            }

            

Reported by PMD.

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

Line: 40

                  }

    @Test
    public void flatMapSingleElementValueDifferentType() {
        Maybe.just(1).concatMapSingle(new Function<Integer, SingleSource<String>>() {
            @Override public SingleSource<String> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Single.just("2");
                }

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 43

                  public void flatMapSingleElementValueDifferentType() {
        Maybe.just(1).concatMapSingle(new Function<Integer, SingleSource<String>>() {
            @Override public SingleSource<String> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Single.just("2");
                }

                return Single.just("1");
            }

            

Reported by PMD.

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

Line: 55

                  }

    @Test
    public void flatMapSingleElementValueNull() {
        Maybe.just(1).concatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override public SingleSource<Integer> apply(final Integer integer) throws Exception {
                return null;
            }
        })

            

Reported by PMD.

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

Line: 68

                  }

    @Test
    public void flatMapSingleElementValueErrorThrown() {
        Maybe.just(1).concatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override public SingleSource<Integer> apply(final Integer integer) throws Exception {
                throw new RuntimeException("something went terribly wrong!");
            }
        })

            

Reported by PMD.

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

Line: 81

                  }

    @Test
    public void flatMapSingleElementError() {
        RuntimeException exception = new RuntimeException("test");

        Maybe.error(exception).concatMapSingle(new Function<Object, SingleSource<Object>>() {
            @Override public SingleSource<Object> apply(final Object integer) throws Exception {
                return Single.just(new Object());

            

Reported by PMD.

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

Line: 94

                  }

    @Test
    public void flatMapSingleElementEmpty() {
        Maybe.<Integer>empty().concatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override public SingleSource<Integer> apply(final Integer integer) throws Exception {
                return Single.just(2);
            }
        })

            

Reported by PMD.

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

Line: 106

                  }

    @Test
    public void dispose() {
        TestHelper.checkDisposed(Maybe.just(1).concatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override
            public SingleSource<Integer> apply(final Integer integer) throws Exception {
                return Single.just(2);
            }

            

Reported by PMD.

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

Line: 108

               * </code></pre>
 * @param <T> the value type
 */
public final class AsyncSubject<T> extends Subject<T> {

    @SuppressWarnings("rawtypes")
    static final AsyncDisposable[] EMPTY = new AsyncDisposable[0];

    @SuppressWarnings("rawtypes")

            

Reported by PMD.

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

Line: 116

                  @SuppressWarnings("rawtypes")
    static final AsyncDisposable[] TERMINATED = new AsyncDisposable[0];

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

    /** Write before updating subscribers, read after reading subscribers as TERMINATED. */
    Throwable error;

    /** Write before updating subscribers, read after reading subscribers as TERMINATED. */

            

Reported by PMD.

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

Line: 119

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

    /** Write before updating subscribers, read after reading subscribers as TERMINATED. */
    Throwable error;

    /** Write before updating subscribers, read after reading subscribers as TERMINATED. */
    T value;

    /**

            

Reported by PMD.

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

Line: 122

                  Throwable error;

    /** Write before updating subscribers, read after reading subscribers as TERMINATED. */
    T value;

    /**
     * Creates a new AsyncProcessor.
     * @param <T> the value type to be received and emitted
     * @return the new AsyncProcessor instance

            

Reported by PMD.

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

Line: 139

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

    @Override

            

Reported by PMD.

Assigning an Object to null is a code smell. Consider refactoring.
Error

Line: 168

                          RxJavaPlugins.onError(t);
            return;
        }
        value = null;
        error = t;
        for (AsyncDisposable<T> as : subscribers.getAndSet(TERMINATED)) {
            as.onError(t);
        }
    }

            

Reported by PMD.

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

Line: 197

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

    @Override
    @CheckReturnValue
    public boolean hasThrowable() {

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 256

              
            int n = a.length;
            @SuppressWarnings("unchecked")
            AsyncDisposable<T>[] b = new AsyncDisposable[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: 293

              
            AsyncDisposable<T>[] b;

            if (n == 1) {
                b = EMPTY;
            } else {
                b = new AsyncDisposable[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: 296

                          if (n == 1) {
                b = EMPTY;
            } else {
                b = new AsyncDisposable[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.

src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleConcatMapMaybeTest.java
13 issues
Avoid throwing raw exception types.
Design

Line: 71

                  public void concatMapMaybeValueErrorThrown() {
        Single.just(1).concatMapMaybe(new Function<Integer, MaybeSource<Integer>>() {
            @Override public MaybeSource<Integer> apply(final Integer integer) throws Exception {
                throw new RuntimeException("something went terribly wrong!");
            }
        })
            .to(TestHelper.<Integer>testConsumer())
            .assertNoValues()
            .assertError(RuntimeException.class)

            

Reported by PMD.

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

Line: 25

              
public class SingleConcatMapMaybeTest extends RxJavaTest {
    @Test
    public void concatMapMaybeValue() {
        Single.just(1).concatMapMaybe(new Function<Integer, MaybeSource<Integer>>() {
            @Override public MaybeSource<Integer> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Maybe.just(2);
                }

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 28

                  public void concatMapMaybeValue() {
        Single.just(1).concatMapMaybe(new Function<Integer, MaybeSource<Integer>>() {
            @Override public MaybeSource<Integer> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Maybe.just(2);
                }

                return Maybe.just(1);
            }

            

Reported by PMD.

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

Line: 40

                  }

    @Test
    public void concatMapMaybeValueDifferentType() {
        Single.just(1).concatMapMaybe(new Function<Integer, MaybeSource<String>>() {
            @Override public MaybeSource<String> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Maybe.just("2");
                }

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 43

                  public void concatMapMaybeValueDifferentType() {
        Single.just(1).concatMapMaybe(new Function<Integer, MaybeSource<String>>() {
            @Override public MaybeSource<String> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Maybe.just("2");
                }

                return Maybe.just("1");
            }

            

Reported by PMD.

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

Line: 55

                  }

    @Test
    public void concatMapMaybeValueNull() {
        Single.just(1).concatMapMaybe(new Function<Integer, MaybeSource<Integer>>() {
            @Override public MaybeSource<Integer> apply(final Integer integer) throws Exception {
                return null;
            }
        })

            

Reported by PMD.

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

Line: 68

                  }

    @Test
    public void concatMapMaybeValueErrorThrown() {
        Single.just(1).concatMapMaybe(new Function<Integer, MaybeSource<Integer>>() {
            @Override public MaybeSource<Integer> apply(final Integer integer) throws Exception {
                throw new RuntimeException("something went terribly wrong!");
            }
        })

            

Reported by PMD.

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

Line: 81

                  }

    @Test
    public void concatMapMaybeError() {
        RuntimeException exception = new RuntimeException("test");

        Single.error(exception).concatMapMaybe(new Function<Object, MaybeSource<Object>>() {
            @Override public MaybeSource<Object> apply(final Object integer) throws Exception {
                return Maybe.just(new Object());

            

Reported by PMD.

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

Line: 94

                  }

    @Test
    public void dispose() {
        TestHelper.checkDisposed(Single.just(1).concatMapMaybe(new Function<Integer, MaybeSource<Integer>>() {
            @Override
            public MaybeSource<Integer> apply(Integer v) throws Exception {
                return Maybe.just(1);
            }

            

Reported by PMD.

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

Line: 104

                  }

    @Test
    public void doubleOnSubscribe() {
        TestHelper.checkDoubleOnSubscribeSingleToMaybe(new Function<Single<Integer>, MaybeSource<Integer>>() {
            @Override
            public MaybeSource<Integer> apply(Single<Integer> v) throws Exception {
                return v.concatMapMaybe(new Function<Integer, MaybeSource<Integer>>() {
                    @Override

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapMaybeTest.java
13 issues
Avoid throwing raw exception types.
Design

Line: 71

                  public void flatMapMaybeValueErrorThrown() {
        Single.just(1).flatMapMaybe(new Function<Integer, MaybeSource<Integer>>() {
            @Override public MaybeSource<Integer> apply(final Integer integer) throws Exception {
                throw new RuntimeException("something went terribly wrong!");
            }
        })
            .to(TestHelper.<Integer>testConsumer())
            .assertNoValues()
            .assertError(RuntimeException.class)

            

Reported by PMD.

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

Line: 25

              
public class SingleFlatMapMaybeTest extends RxJavaTest {
    @Test
    public void flatMapMaybeValue() {
        Single.just(1).flatMapMaybe(new Function<Integer, MaybeSource<Integer>>() {
            @Override public MaybeSource<Integer> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Maybe.just(2);
                }

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 28

                  public void flatMapMaybeValue() {
        Single.just(1).flatMapMaybe(new Function<Integer, MaybeSource<Integer>>() {
            @Override public MaybeSource<Integer> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Maybe.just(2);
                }

                return Maybe.just(1);
            }

            

Reported by PMD.

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

Line: 40

                  }

    @Test
    public void flatMapMaybeValueDifferentType() {
        Single.just(1).flatMapMaybe(new Function<Integer, MaybeSource<String>>() {
            @Override public MaybeSource<String> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Maybe.just("2");
                }

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 43

                  public void flatMapMaybeValueDifferentType() {
        Single.just(1).flatMapMaybe(new Function<Integer, MaybeSource<String>>() {
            @Override public MaybeSource<String> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Maybe.just("2");
                }

                return Maybe.just("1");
            }

            

Reported by PMD.

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

Line: 55

                  }

    @Test
    public void flatMapMaybeValueNull() {
        Single.just(1).flatMapMaybe(new Function<Integer, MaybeSource<Integer>>() {
            @Override public MaybeSource<Integer> apply(final Integer integer) throws Exception {
                return null;
            }
        })

            

Reported by PMD.

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

Line: 68

                  }

    @Test
    public void flatMapMaybeValueErrorThrown() {
        Single.just(1).flatMapMaybe(new Function<Integer, MaybeSource<Integer>>() {
            @Override public MaybeSource<Integer> apply(final Integer integer) throws Exception {
                throw new RuntimeException("something went terribly wrong!");
            }
        })

            

Reported by PMD.

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

Line: 81

                  }

    @Test
    public void flatMapMaybeError() {
        RuntimeException exception = new RuntimeException("test");

        Single.error(exception).flatMapMaybe(new Function<Object, MaybeSource<Object>>() {
            @Override public MaybeSource<Object> apply(final Object integer) throws Exception {
                return Maybe.just(new Object());

            

Reported by PMD.

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

Line: 94

                  }

    @Test
    public void dispose() {
        TestHelper.checkDisposed(Single.just(1).flatMapMaybe(new Function<Integer, MaybeSource<Integer>>() {
            @Override
            public MaybeSource<Integer> apply(Integer v) throws Exception {
                return Maybe.just(1);
            }

            

Reported by PMD.

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

Line: 104

                  }

    @Test
    public void doubleOnSubscribe() {
        TestHelper.checkDoubleOnSubscribeSingleToMaybe(new Function<Single<Integer>, MaybeSource<Integer>>() {
            @Override
            public MaybeSource<Integer> apply(Single<Integer> v) throws Exception {
                return v.flatMapMaybe(new Function<Integer, MaybeSource<Integer>>() {
                    @Override

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAndThenTest.java
13 issues
JUnit tests should include assert() or fail()
Design

Line: 23

              
public class CompletableAndThenTest extends RxJavaTest {
    @Test
    public void andThenMaybeCompleteValue() {
        Completable.complete()
            .andThen(Maybe.just(1))
            .test()
            .assertResult(1);
    }

            

Reported by PMD.

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

Line: 24

              public class CompletableAndThenTest extends RxJavaTest {
    @Test
    public void andThenMaybeCompleteValue() {
        Completable.complete()
            .andThen(Maybe.just(1))
            .test()
            .assertResult(1);
    }


            

Reported by PMD.

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

Line: 24

              public class CompletableAndThenTest extends RxJavaTest {
    @Test
    public void andThenMaybeCompleteValue() {
        Completable.complete()
            .andThen(Maybe.just(1))
            .test()
            .assertResult(1);
    }


            

Reported by PMD.

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

Line: 24

              public class CompletableAndThenTest extends RxJavaTest {
    @Test
    public void andThenMaybeCompleteValue() {
        Completable.complete()
            .andThen(Maybe.just(1))
            .test()
            .assertResult(1);
    }


            

Reported by PMD.

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

Line: 31

                  }

    @Test
    public void andThenMaybeCompleteError() {
        Completable.complete()
            .andThen(Maybe.error(new RuntimeException("test")))
            .to(TestHelper.testConsumer())
            .assertNotComplete()
            .assertNoValues()

            

Reported by PMD.

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

Line: 42

                  }

    @Test
    public void andThenMaybeCompleteEmpty() {
        Completable.complete()
            .andThen(Maybe.empty())
            .test()
            .assertNoValues()
            .assertNoErrors()

            

Reported by PMD.

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

Line: 43

              
    @Test
    public void andThenMaybeCompleteEmpty() {
        Completable.complete()
            .andThen(Maybe.empty())
            .test()
            .assertNoValues()
            .assertNoErrors()
            .assertComplete();

            

Reported by PMD.

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

Line: 43

              
    @Test
    public void andThenMaybeCompleteEmpty() {
        Completable.complete()
            .andThen(Maybe.empty())
            .test()
            .assertNoValues()
            .assertNoErrors()
            .assertComplete();

            

Reported by PMD.

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

Line: 43

              
    @Test
    public void andThenMaybeCompleteEmpty() {
        Completable.complete()
            .andThen(Maybe.empty())
            .test()
            .assertNoValues()
            .assertNoErrors()
            .assertComplete();

            

Reported by PMD.

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

Line: 43

              
    @Test
    public void andThenMaybeCompleteEmpty() {
        Completable.complete()
            .andThen(Maybe.empty())
            .test()
            .assertNoValues()
            .assertNoErrors()
            .assertComplete();

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/core/SchedulerTest.java
13 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 35

                  }

    @Test
    public void driftUseNanoTimeNotSetByDefault() {
      assertFalse(Scheduler.IS_DRIFT_USE_NANOTIME);
      assertFalse(Boolean.getBoolean(DRIFT_USE_NANOTIME));
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 36

              
    @Test
    public void driftUseNanoTimeNotSetByDefault() {
      assertFalse(Scheduler.IS_DRIFT_USE_NANOTIME);
      assertFalse(Boolean.getBoolean(DRIFT_USE_NANOTIME));
    }

    @Test
    public void computeNow_currentTimeMillis() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 37

                  @Test
    public void driftUseNanoTimeNotSetByDefault() {
      assertFalse(Scheduler.IS_DRIFT_USE_NANOTIME);
      assertFalse(Boolean.getBoolean(DRIFT_USE_NANOTIME));
    }

    @Test
    public void computeNow_currentTimeMillis() {
      TimeUnit unit = TimeUnit.MILLISECONDS;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 43

                  @Test
    public void computeNow_currentTimeMillis() {
      TimeUnit unit = TimeUnit.MILLISECONDS;
      assertTrue(isInRange(System.currentTimeMillis(), Scheduler.computeNow(unit), unit, 250, TimeUnit.MILLISECONDS));
    }

    @Test
    public void computeNow_nanoTime() {
      TimeUnit unit = TimeUnit.NANOSECONDS;

            

Reported by PMD.

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

Line: 47

                  }

    @Test
    public void computeNow_nanoTime() {
      TimeUnit unit = TimeUnit.NANOSECONDS;
      Scheduler.IS_DRIFT_USE_NANOTIME = true;

      assertFalse(isInRange(System.currentTimeMillis(), Scheduler.computeNow(unit), unit, 250, TimeUnit.MILLISECONDS));
      assertTrue(isInRange(System.nanoTime(), Scheduler.computeNow(unit), TimeUnit.NANOSECONDS, 250, TimeUnit.MILLISECONDS));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 51

                    TimeUnit unit = TimeUnit.NANOSECONDS;
      Scheduler.IS_DRIFT_USE_NANOTIME = true;

      assertFalse(isInRange(System.currentTimeMillis(), Scheduler.computeNow(unit), unit, 250, TimeUnit.MILLISECONDS));
      assertTrue(isInRange(System.nanoTime(), Scheduler.computeNow(unit), TimeUnit.NANOSECONDS, 250, TimeUnit.MILLISECONDS));
    }

    private boolean isInRange(long start, long stop, TimeUnit source, long maxDiff, TimeUnit diffUnit) {
      long diff = Math.abs(stop - start);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 52

                    Scheduler.IS_DRIFT_USE_NANOTIME = true;

      assertFalse(isInRange(System.currentTimeMillis(), Scheduler.computeNow(unit), unit, 250, TimeUnit.MILLISECONDS));
      assertTrue(isInRange(System.nanoTime(), Scheduler.computeNow(unit), TimeUnit.NANOSECONDS, 250, TimeUnit.MILLISECONDS));
    }

    private boolean isInRange(long start, long stop, TimeUnit source, long maxDiff, TimeUnit diffUnit) {
      long diff = Math.abs(stop - start);
      return diffUnit.convert(diff, source) <= maxDiff;

            

Reported by PMD.

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

Line: 61

                  }

    @Test
    public void clockDriftCalculation() {
        assertEquals(100_000_000L, Scheduler.computeClockDrift(100, "milliseconds"));

        assertEquals(2_000_000_000L, Scheduler.computeClockDrift(2, "seconds"));

        assertEquals(180_000_000_000L, Scheduler.computeClockDrift(3, "minutes"));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 62

              
    @Test
    public void clockDriftCalculation() {
        assertEquals(100_000_000L, Scheduler.computeClockDrift(100, "milliseconds"));

        assertEquals(2_000_000_000L, Scheduler.computeClockDrift(2, "seconds"));

        assertEquals(180_000_000_000L, Scheduler.computeClockDrift(3, "minutes"));


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 64

                  public void clockDriftCalculation() {
        assertEquals(100_000_000L, Scheduler.computeClockDrift(100, "milliseconds"));

        assertEquals(2_000_000_000L, Scheduler.computeClockDrift(2, "seconds"));

        assertEquals(180_000_000_000L, Scheduler.computeClockDrift(3, "minutes"));

        assertEquals(240_000_000_000L, Scheduler.computeClockDrift(4, "random"));


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingleTest.java
13 issues
Avoid throwing raw exception types.
Design

Line: 76

                  public void flatMapSingleValueErrorThrown() {
        Maybe.just(1).flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override public SingleSource<Integer> apply(final Integer integer) throws Exception {
                throw new RuntimeException("something went terribly wrong!");
            }
        })
        .toSingle()
        .to(TestHelper.<Integer>testConsumer())
            .assertNoValues()

            

Reported by PMD.

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

Line: 27

              
public class MaybeFlatMapSingleTest extends RxJavaTest {
    @Test
    public void flatMapSingleValue() {
        Maybe.just(1).flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override public SingleSource<Integer> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Single.just(2);
                }

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 30

                  public void flatMapSingleValue() {
        Maybe.just(1).flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override public SingleSource<Integer> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Single.just(2);
                }

                return Single.just(1);
            }

            

Reported by PMD.

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

Line: 43

                  }

    @Test
    public void flatMapSingleValueDifferentType() {
        Maybe.just(1).flatMapSingle(new Function<Integer, SingleSource<String>>() {
            @Override public SingleSource<String> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Single.just("2");
                }

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 46

                  public void flatMapSingleValueDifferentType() {
        Maybe.just(1).flatMapSingle(new Function<Integer, SingleSource<String>>() {
            @Override public SingleSource<String> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Single.just("2");
                }

                return Single.just("1");
            }

            

Reported by PMD.

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

Line: 59

                  }

    @Test
    public void flatMapSingleValueNull() {
        Maybe.just(1).flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override public SingleSource<Integer> apply(final Integer integer) throws Exception {
                return null;
            }
        })

            

Reported by PMD.

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

Line: 73

                  }

    @Test
    public void flatMapSingleValueErrorThrown() {
        Maybe.just(1).flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override public SingleSource<Integer> apply(final Integer integer) throws Exception {
                throw new RuntimeException("something went terribly wrong!");
            }
        })

            

Reported by PMD.

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

Line: 87

                  }

    @Test
    public void flatMapSingleError() {
        RuntimeException exception = new RuntimeException("test");

        Maybe.error(exception).flatMapSingle(new Function<Object, SingleSource<Object>>() {
            @Override public SingleSource<Object> apply(final Object integer) throws Exception {
                return Single.just(new Object());

            

Reported by PMD.

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

Line: 101

                  }

    @Test
    public void flatMapSingleEmpty() {
        Maybe.<Integer>empty().flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override public SingleSource<Integer> apply(final Integer integer) throws Exception {
                return Single.just(2);
            }
        })

            

Reported by PMD.

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

Line: 114

                  }

    @Test
    public void dispose() {
        TestHelper.checkDisposed(Maybe.just(1).flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override
            public SingleSource<Integer> apply(final Integer integer) throws Exception {
                return Single.just(2);
            }

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFlatMapSingleElementTest.java
13 issues
Avoid throwing raw exception types.
Design

Line: 71

                  public void flatMapSingleValueErrorThrown() {
        Maybe.just(1).flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override public SingleSource<Integer> apply(final Integer integer) throws Exception {
                throw new RuntimeException("something went terribly wrong!");
            }
        })
            .to(TestHelper.<Integer>testConsumer())
            .assertNoValues()
            .assertError(RuntimeException.class)

            

Reported by PMD.

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

Line: 25

              
public class MaybeFlatMapSingleElementTest extends RxJavaTest {
    @Test
    public void flatMapSingleValue() {
        Maybe.just(1).flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override public SingleSource<Integer> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Single.just(2);
                }

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 28

                  public void flatMapSingleValue() {
        Maybe.just(1).flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override public SingleSource<Integer> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Single.just(2);
                }

                return Single.just(1);
            }

            

Reported by PMD.

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

Line: 40

                  }

    @Test
    public void flatMapSingleValueDifferentType() {
        Maybe.just(1).flatMapSingle(new Function<Integer, SingleSource<String>>() {
            @Override public SingleSource<String> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Single.just("2");
                }

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 43

                  public void flatMapSingleValueDifferentType() {
        Maybe.just(1).flatMapSingle(new Function<Integer, SingleSource<String>>() {
            @Override public SingleSource<String> apply(final Integer integer) throws Exception {
                if (integer == 1) {
                    return Single.just("2");
                }

                return Single.just("1");
            }

            

Reported by PMD.

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

Line: 55

                  }

    @Test
    public void flatMapSingleValueNull() {
        Maybe.just(1).flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override public SingleSource<Integer> apply(final Integer integer) throws Exception {
                return null;
            }
        })

            

Reported by PMD.

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

Line: 68

                  }

    @Test
    public void flatMapSingleValueErrorThrown() {
        Maybe.just(1).flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override public SingleSource<Integer> apply(final Integer integer) throws Exception {
                throw new RuntimeException("something went terribly wrong!");
            }
        })

            

Reported by PMD.

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

Line: 81

                  }

    @Test
    public void flatMapSingleError() {
        RuntimeException exception = new RuntimeException("test");

        Maybe.error(exception).flatMapSingle(new Function<Object, SingleSource<Object>>() {
            @Override public SingleSource<Object> apply(final Object integer) throws Exception {
                return Single.just(new Object());

            

Reported by PMD.

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

Line: 94

                  }

    @Test
    public void flatMapSingleEmpty() {
        Maybe.<Integer>empty().flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override public SingleSource<Integer> apply(final Integer integer) throws Exception {
                return Single.just(2);
            }
        })

            

Reported by PMD.

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

Line: 106

                  }

    @Test
    public void dispose() {
        TestHelper.checkDisposed(Maybe.just(1).flatMapSingle(new Function<Integer, SingleSource<Integer>>() {
            @Override
            public SingleSource<Integer> apply(final Integer integer) throws Exception {
                return Single.just(2);
            }

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/core/BackpressureEnumTest.java
13 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 25

              public class BackpressureEnumTest extends RxJavaTest {

    @Test
    public void backpressureOverflowStrategy() {
        assertEquals(3, BackpressureOverflowStrategy.values().length);

        assertNotNull(BackpressureOverflowStrategy.valueOf("ERROR"));
    }


            

Reported by PMD.

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

Line: 26

              
    @Test
    public void backpressureOverflowStrategy() {
        assertEquals(3, BackpressureOverflowStrategy.values().length);

        assertNotNull(BackpressureOverflowStrategy.valueOf("ERROR"));
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 26

              
    @Test
    public void backpressureOverflowStrategy() {
        assertEquals(3, BackpressureOverflowStrategy.values().length);

        assertNotNull(BackpressureOverflowStrategy.valueOf("ERROR"));
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 28

                  public void backpressureOverflowStrategy() {
        assertEquals(3, BackpressureOverflowStrategy.values().length);

        assertNotNull(BackpressureOverflowStrategy.valueOf("ERROR"));
    }

    @Test
    public void backpressureStrategy() {
        assertEquals(5, BackpressureStrategy.values().length);

            

Reported by PMD.

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

Line: 32

                  }

    @Test
    public void backpressureStrategy() {
        assertEquals(5, BackpressureStrategy.values().length);

        assertNotNull(BackpressureStrategy.valueOf("BUFFER"));
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 33

              
    @Test
    public void backpressureStrategy() {
        assertEquals(5, BackpressureStrategy.values().length);

        assertNotNull(BackpressureStrategy.valueOf("BUFFER"));
    }

    @Test

            

Reported by PMD.

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

Line: 33

              
    @Test
    public void backpressureStrategy() {
        assertEquals(5, BackpressureStrategy.values().length);

        assertNotNull(BackpressureStrategy.valueOf("BUFFER"));
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 35

                  public void backpressureStrategy() {
        assertEquals(5, BackpressureStrategy.values().length);

        assertNotNull(BackpressureStrategy.valueOf("BUFFER"));
    }

    @Test
    public void backpressureKind() {
        assertEquals(6, BackpressureKind.values().length);

            

Reported by PMD.

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

Line: 39

                  }

    @Test
    public void backpressureKind() {
        assertEquals(6, BackpressureKind.values().length);

        assertNotNull(BackpressureKind.valueOf("FULL"));
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 40

              
    @Test
    public void backpressureKind() {
        assertEquals(6, BackpressureKind.values().length);

        assertNotNull(BackpressureKind.valueOf("FULL"));
    }

}

            

Reported by PMD.