The following issues were found

src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeJustTest.java
6 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 27

              
    @SuppressWarnings("unchecked")
    @Test
    public void scalarSupplier() {
        Maybe<Integer> m = Maybe.just(1);

        assertTrue(m.getClass().toString(), m instanceof ScalarSupplier);

        assertEquals(1, ((ScalarSupplier<Integer>)m).get().intValue());

            

Reported by PMD.

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

Line: 30

                  public void scalarSupplier() {
        Maybe<Integer> m = Maybe.just(1);

        assertTrue(m.getClass().toString(), m instanceof ScalarSupplier);

        assertEquals(1, ((ScalarSupplier<Integer>)m).get().intValue());
    }
}

            

Reported by PMD.

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

Line: 30

                  public void scalarSupplier() {
        Maybe<Integer> m = Maybe.just(1);

        assertTrue(m.getClass().toString(), m instanceof ScalarSupplier);

        assertEquals(1, ((ScalarSupplier<Integer>)m).get().intValue());
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 32

              
        assertTrue(m.getClass().toString(), m instanceof ScalarSupplier);

        assertEquals(1, ((ScalarSupplier<Integer>)m).get().intValue());
    }
}

            

Reported by PMD.

Avoid unused imports such as 'org.junit.Assert'
Design

Line: 16

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

import static org.junit.Assert.*;

import org.junit.Test;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.internal.fuseable.ScalarSupplier;

            

Reported by PMD.

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

Line: 20

              
import org.junit.Test;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.internal.fuseable.ScalarSupplier;

public class MaybeJustTest extends RxJavaTest {

    @SuppressWarnings("unchecked")

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/schedulers/Timed.java
6 issues
Field value has the same name as a method
Error

Line: 27

               * @param <T> the value type
 */
public final class Timed<T> {
    final T value;
    final long time;
    final TimeUnit unit;

    /**
     * Constructs a {@code Timed} instance with the given value and time information.

            

Reported by PMD.

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

Line: 27

               * @param <T> the value type
 */
public final class Timed<T> {
    final T value;
    final long time;
    final TimeUnit unit;

    /**
     * Constructs a {@code Timed} instance with the given value and time information.

            

Reported by PMD.

Field time has the same name as a method
Error

Line: 28

               */
public final class Timed<T> {
    final T value;
    final long time;
    final TimeUnit unit;

    /**
     * Constructs a {@code Timed} instance with the given value and time information.
     * @param value the value to hold

            

Reported by PMD.

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

Line: 28

               */
public final class Timed<T> {
    final T value;
    final long time;
    final TimeUnit unit;

    /**
     * Constructs a {@code Timed} instance with the given value and time information.
     * @param value the value to hold

            

Reported by PMD.

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

Line: 29

              public final class Timed<T> {
    final T value;
    final long time;
    final TimeUnit unit;

    /**
     * Constructs a {@code Timed} instance with the given value and time information.
     * @param value the value to hold
     * @param time the time to hold

            

Reported by PMD.

Field unit has the same name as a method
Error

Line: 29

              public final class Timed<T> {
    final T value;
    final long time;
    final TimeUnit unit;

    /**
     * Constructs a {@code Timed} instance with the given value and time information.
     * @param value the value to hold
     * @param time the time to hold

            

Reported by PMD.

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

Line: 28

              public class MaybeFilterSingleTest extends RxJavaTest {

    @Test
    public void error() {
        Single.error(new TestException())
        .filter(Functions.alwaysTrue())
        .test()
        .assertFailure(TestException.class);
    }

            

Reported by PMD.

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

Line: 36

                  }

    @Test
    public void dispose() {
        TestHelper.checkDisposed(PublishSubject.create().singleOrError().filter(Functions.alwaysTrue()));
    }

    @Test
    public void doubleOnSubscribe() {

            

Reported by PMD.

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

Line: 37

              
    @Test
    public void dispose() {
        TestHelper.checkDisposed(PublishSubject.create().singleOrError().filter(Functions.alwaysTrue()));
    }

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

            

Reported by PMD.

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

Line: 37

              
    @Test
    public void dispose() {
        TestHelper.checkDisposed(PublishSubject.create().singleOrError().filter(Functions.alwaysTrue()));
    }

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

            

Reported by PMD.

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

Line: 41

                  }

    @Test
    public void doubleOnSubscribe() {
        TestHelper.checkDoubleOnSubscribeSingleToMaybe(new Function<Single<Object>, MaybeSource<Object>>() {
            @Override
            public MaybeSource<Object> apply(Single<Object> v) throws Exception {
                return v.filter(Functions.alwaysTrue());
            }

            

Reported by PMD.

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

Line: 18

              
import org.junit.Test;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.functions.Function;
import io.reactivex.rxjava3.internal.functions.Functions;
import io.reactivex.rxjava3.subjects.PublishSubject;
import io.reactivex.rxjava3.testsupport.TestHelper;

            

Reported by PMD.

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

Line: 28

              public class SubscribeWithTest extends RxJavaTest {

    @Test
    public void withFlowable() {
        Flowable.range(1, 10)
        .subscribeWith(new TestSubscriber<>())
        .assertResult(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
    }


            

Reported by PMD.

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

Line: 35

                  }

    @Test
    public void withObservable() {
        Observable.range(1, 10)
        .subscribeWith(new TestObserver<>())
        .assertResult(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
    }


            

Reported by PMD.

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

Line: 42

                  }

    class ObserverImpl implements SingleObserver<Object>, CompletableObserver {
        Object value;

        @Override
        public void onSubscribe(Disposable d) {

        }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 67

              
    @Test
    public void withSingle() {
        assertEquals(1, Single.just(1).subscribeWith(new ObserverImpl()).value);
    }

    @Test
    public void withCompletable() {
        assertEquals(100, Completable.complete().subscribeWith(new ObserverImpl()).value);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 72

              
    @Test
    public void withCompletable() {
        assertEquals(100, Completable.complete().subscribeWith(new ObserverImpl()).value);
    }

}

            

Reported by PMD.

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

Line: 20

              
import org.junit.Test;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.observers.TestObserver;
import io.reactivex.rxjava3.subscribers.TestSubscriber;

public class SubscribeWithTest extends RxJavaTest {

            

Reported by PMD.

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

Line: 31

              public class CompletablePeekTest extends RxJavaTest {

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

            

Reported by PMD.

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

Line: 51

                  }

    @Test
    public void disposed() {
        TestHelper.checkDisposed(CompletableSubject.create().doOnComplete(Functions.EMPTY_ACTION));
    }
}

            

Reported by PMD.

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

Line: 52

              
    @Test
    public void disposed() {
        TestHelper.checkDisposed(CompletableSubject.create().doOnComplete(Functions.EMPTY_ACTION));
    }
}

            

Reported by PMD.

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

Line: 20

              
import org.junit.Test;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.functions.Action;
import io.reactivex.rxjava3.internal.functions.Functions;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;
import io.reactivex.rxjava3.subjects.CompletableSubject;

            

Reported by PMD.

Found 'DU'-anomaly for variable 'errors' (lines '32'-'48').
Error

Line: 32

              
    @Test
    public void onAfterTerminateCrashes() {
        List<Throwable> errors = TestHelper.trackPluginErrors();
        try {
            Completable.complete()
            .doAfterTerminate(new Action() {
                @Override
                public void run() throws Exception {

            

Reported by PMD.

Found 'DU'-anomaly for variable 'errors' (lines '32'-'48').
Error

Line: 32

              
    @Test
    public void onAfterTerminateCrashes() {
        List<Throwable> errors = TestHelper.trackPluginErrors();
        try {
            Completable.complete()
            .doAfterTerminate(new Action() {
                @Override
                public void run() throws Exception {

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleHideTest.java
6 issues
JUnit tests should include assert() or fail()
Design

Line: 27

              public class SingleHideTest extends RxJavaTest {

    @Test
    public void error() {
        Single.error(new TestException())
        .hide()
        .test()
        .assertFailure(TestException.class);
    }

            

Reported by PMD.

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

Line: 35

                  }

    @Test
    public void dispose() {
        TestHelper.checkDisposed(PublishSubject.create().singleOrError().hide());
    }

    @Test
    public void doubleOnSubscribe() {

            

Reported by PMD.

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

Line: 36

              
    @Test
    public void dispose() {
        TestHelper.checkDisposed(PublishSubject.create().singleOrError().hide());
    }

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

            

Reported by PMD.

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

Line: 36

              
    @Test
    public void dispose() {
        TestHelper.checkDisposed(PublishSubject.create().singleOrError().hide());
    }

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

            

Reported by PMD.

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

Line: 40

                  }

    @Test
    public void doubleOnSubscribe() {
        TestHelper.checkDoubleOnSubscribeSingle(new Function<Single<Object>, SingleSource<Object>>() {
            @Override
            public SingleSource<Object> apply(Single<Object> s) throws Exception {
                return s.hide();
            }

            

Reported by PMD.

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

Line: 18

              
import org.junit.Test;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.functions.Function;
import io.reactivex.rxjava3.subjects.PublishSubject;
import io.reactivex.rxjava3.testsupport.TestHelper;


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLiftTest.java
6 issues
Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block
Design

Line: 43

                          })
            .test();
            fail("Should have thrown");
        } catch (NullPointerException ex) {
            assertTrue(ex.toString(), ex.getCause() instanceof TestException);
            TestHelper.assertUndeliverable(errors, 0, TestException.class);
        } finally {
            RxJavaPlugins.reset();
        }

            

Reported by PMD.

Avoid catching NullPointerException; consider removing the cause of the NPE.
Error

Line: 43

                          })
            .test();
            fail("Should have thrown");
        } catch (NullPointerException ex) {
            assertTrue(ex.toString(), ex.getCause() instanceof TestException);
            TestHelper.assertUndeliverable(errors, 0, TestException.class);
        } finally {
            RxJavaPlugins.reset();
        }

            

Reported by PMD.

Avoid unused imports such as 'org.junit.Assert'
Design

Line: 16

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

import static org.junit.Assert.*;

import java.util.List;

import org.junit.Test;
import org.reactivestreams.Subscriber;

            

Reported by PMD.

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

Line: 23

              import org.junit.Test;
import org.reactivestreams.Subscriber;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;
import io.reactivex.rxjava3.testsupport.TestHelper;

public class FlowableLiftTest extends RxJavaTest {

            

Reported by PMD.

Found 'DU'-anomaly for variable 'errors' (lines '32'-'49').
Error

Line: 32

              
    @Test
    public void callbackCrash() {
        List<Throwable> errors = TestHelper.trackPluginErrors();
        try {
            Flowable.just(1)
            .lift(new FlowableOperator<Object, Integer>() {
                @Override
                public Subscriber<? super Integer> apply(Subscriber<? super Object> subscriber) throws Exception {

            

Reported by PMD.

Found 'DU'-anomaly for variable 'errors' (lines '32'-'49').
Error

Line: 32

              
    @Test
    public void callbackCrash() {
        List<Throwable> errors = TestHelper.trackPluginErrors();
        try {
            Flowable.just(1)
            .lift(new FlowableOperator<Object, Integer>() {
                @Override
                public Subscriber<? super Integer> apply(Subscriber<? super Object> subscriber) throws Exception {

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/observable/Burst.java
6 issues
Field items has the same name as a method
Error

Line: 30

               */
public final class Burst<T> extends Observable<T> {

    final List<T> items;
    final Throwable error;

    Burst(Throwable error, List<T> items) {
        this.error = error;
        this.items = items;

            

Reported by PMD.

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

Line: 30

               */
public final class Burst<T> extends Observable<T> {

    final List<T> items;
    final Throwable error;

    Burst(Throwable error, List<T> items) {
        this.error = error;
        this.items = items;

            

Reported by PMD.

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

Line: 31

              public final class Burst<T> extends Observable<T> {

    final List<T> items;
    final Throwable error;

    Burst(Throwable error, List<T> items) {
        this.error = error;
        this.items = items;
    }

            

Reported by PMD.

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

Line: 62

              
    public static final class Builder<T> {

        private final List<T> items;
        private Throwable error;

        Builder(List<T> items) {
            this.items = items;
        }

            

Reported by PMD.

Field error has the same name as a method
Error

Line: 63

                  public static final class Builder<T> {

        private final List<T> items;
        private Throwable error;

        Builder(List<T> items) {
            this.items = items;
        }


            

Reported by PMD.

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

Line: 63

                  public static final class Builder<T> {

        private final List<T> items;
        private Throwable error;

        Builder(List<T> items) {
            this.items = items;
        }


            

Reported by PMD.

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

Line: 25

              public class FutureMultiObserverTest extends RxJavaTest {

    @Test
    public void cancelBeforeOnSubscribe() {
        FutureMultiObserver<Integer> f = new FutureMultiObserver<>();

        assertTrue(f.cancel(true));

        Disposable d = Disposable.empty();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 28

                  public void cancelBeforeOnSubscribe() {
        FutureMultiObserver<Integer> f = new FutureMultiObserver<>();

        assertTrue(f.cancel(true));

        Disposable d = Disposable.empty();

        f.onSubscribe(d);


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 34

              
        f.onSubscribe(d);

        assertTrue(d.isDisposed());
    }

    @Test
    public void onCompleteJustAfterDispose() {
        FutureMultiObserver<Integer> f = new FutureMultiObserver<>();

            

Reported by PMD.

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

Line: 34

              
        f.onSubscribe(d);

        assertTrue(d.isDisposed());
    }

    @Test
    public void onCompleteJustAfterDispose() {
        FutureMultiObserver<Integer> f = new FutureMultiObserver<>();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 42

                      FutureMultiObserver<Integer> f = new FutureMultiObserver<>();
        Disposable d = Disposable.empty();
        f.onSubscribe(d);
        assertTrue(f.cancel(true));

        f.onComplete();
    }
}

            

Reported by PMD.

Avoid unused imports such as 'org.junit.Assert'
Design

Line: 16

              
package io.reactivex.rxjava3.internal.observers;

import static org.junit.Assert.*;
import org.junit.Test;

import io.reactivex.rxjava3.core.RxJavaTest;
import io.reactivex.rxjava3.disposables.Disposable;


            

Reported by PMD.

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

Line: 47

                          }
        });

        assertEquals(Arrays.asList(1, 2, 3), list);
    }

    @Test
    public void forEachWileWithError() {
        final List<Object> list = new ArrayList<>();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 73

                          }
        });

        assertEquals(Arrays.asList(1, 2, 3, 4, 5, 100), list);
    }

    @Test
    public void dispose() {
        TestHelper.checkDisposed(

            

Reported by PMD.

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

Line: 77

                  }

    @Test
    public void dispose() {
        TestHelper.checkDisposed(
                Flowable.never()
                .forEachWhile(v -> true)
        );
    }

            

Reported by PMD.

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

Line: 79

                  @Test
    public void dispose() {
        TestHelper.checkDisposed(
                Flowable.never()
                .forEachWhile(v -> true)
        );
    }
}

            

Reported by PMD.

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

Line: 22

              
import org.junit.Test;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.functions.*;
import io.reactivex.rxjava3.testsupport.TestHelper;

public class FlowableForEachTest extends RxJavaTest {

            

Reported by PMD.

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

Line: 24

              
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.functions.*;
import io.reactivex.rxjava3.testsupport.TestHelper;

public class FlowableForEachTest extends RxJavaTest {

    @Test

            

Reported by PMD.