The following issues were found

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

Line: 31

              import io.reactivex.rxjava3.subscribers.TestSubscriber;
import io.reactivex.rxjava3.testsupport.TestHelper;

public class FlowableThrottleLatestTest extends RxJavaTest {

    @Test
    public void just() {
        Flowable.just(1)
        .throttleLatest(1, TimeUnit.MINUTES)

            

Reported by PMD.

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

Line: 34

              public class FlowableThrottleLatestTest extends RxJavaTest {

    @Test
    public void just() {
        Flowable.just(1)
        .throttleLatest(1, TimeUnit.MINUTES)
        .test()
        .assertResult(1);
    }

            

Reported by PMD.

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

Line: 35

              
    @Test
    public void just() {
        Flowable.just(1)
        .throttleLatest(1, TimeUnit.MINUTES)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 35

              
    @Test
    public void just() {
        Flowable.just(1)
        .throttleLatest(1, TimeUnit.MINUTES)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 35

              
    @Test
    public void just() {
        Flowable.just(1)
        .throttleLatest(1, TimeUnit.MINUTES)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 42

                  }

    @Test
    public void range() {
        Flowable.range(1, 5)
        .throttleLatest(1, TimeUnit.MINUTES)
        .test()
        .assertResult(1);
    }

            

Reported by PMD.

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

Line: 43

              
    @Test
    public void range() {
        Flowable.range(1, 5)
        .throttleLatest(1, TimeUnit.MINUTES)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 43

              
    @Test
    public void range() {
        Flowable.range(1, 5)
        .throttleLatest(1, TimeUnit.MINUTES)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 43

              
    @Test
    public void range() {
        Flowable.range(1, 5)
        .throttleLatest(1, TimeUnit.MINUTES)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 50

                  }

    @Test
    public void rangeEmitLatest() {
        Flowable.range(1, 5)
        .throttleLatest(1, TimeUnit.MINUTES, true)
        .test()
        .assertResult(1, 5);
    }

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/schedulers/ScheduledRunnableTest.java
95 issues
The class 'ScheduledRunnableTest' has a Modified Cyclomatic Complexity of 3 (Highest = 14).
Design

Line: 32

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

public class ScheduledRunnableTest extends RxJavaTest {

    @Test
    public void dispose() {
        CompositeDisposable set = new CompositeDisposable();
        ScheduledRunnable run = new ScheduledRunnable(Functions.EMPTY_RUNNABLE, set);

            

Reported by PMD.

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

Line: 32

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

public class ScheduledRunnableTest extends RxJavaTest {

    @Test
    public void dispose() {
        CompositeDisposable set = new CompositeDisposable();
        ScheduledRunnable run = new ScheduledRunnable(Functions.EMPTY_RUNNABLE, set);

            

Reported by PMD.

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

Line: 32

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

public class ScheduledRunnableTest extends RxJavaTest {

    @Test
    public void dispose() {
        CompositeDisposable set = new CompositeDisposable();
        ScheduledRunnable run = new ScheduledRunnable(Functions.EMPTY_RUNNABLE, set);

            

Reported by PMD.

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

Line: 35

              public class ScheduledRunnableTest extends RxJavaTest {

    @Test
    public void dispose() {
        CompositeDisposable set = new CompositeDisposable();
        ScheduledRunnable run = new ScheduledRunnable(Functions.EMPTY_RUNNABLE, set);
        set.add(run);

        assertFalse(run.isDisposed());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 40

                      ScheduledRunnable run = new ScheduledRunnable(Functions.EMPTY_RUNNABLE, set);
        set.add(run);

        assertFalse(run.isDisposed());

        set.dispose();

        assertTrue(run.isDisposed());
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 44

              
        set.dispose();

        assertTrue(run.isDisposed());
    }

    @Test
    public void disposeRun() {
        CompositeDisposable set = new CompositeDisposable();

            

Reported by PMD.

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

Line: 48

                  }

    @Test
    public void disposeRun() {
        CompositeDisposable set = new CompositeDisposable();
        ScheduledRunnable run = new ScheduledRunnable(Functions.EMPTY_RUNNABLE, set);
        set.add(run);

        assertFalse(run.isDisposed());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 53

                      ScheduledRunnable run = new ScheduledRunnable(Functions.EMPTY_RUNNABLE, set);
        set.add(run);

        assertFalse(run.isDisposed());

        run.dispose();
        run.dispose();

        assertTrue(run.isDisposed());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 58

                      run.dispose();
        run.dispose();

        assertTrue(run.isDisposed());
    }

    @Test
    public void setFutureCancelRace() {
        for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 64

                  @Test
    public void setFutureCancelRace() {
        for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) {
            CompositeDisposable set = new CompositeDisposable();
            final ScheduledRunnable run = new ScheduledRunnable(Functions.EMPTY_RUNNABLE, set);
            set.add(run);

            final FutureTask<Object> ft = new FutureTask<>(Functions.EMPTY_RUNNABLE, 0);


            

Reported by PMD.

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

Line: 31

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

public class MaybeDelayOtherTest extends RxJavaTest {

    @Test
    public void justWithOnNext() {
        PublishProcessor<Object> pp = PublishProcessor.create();


            

Reported by PMD.

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

Line: 34

              public class MaybeDelayOtherTest extends RxJavaTest {

    @Test
    public void justWithOnNext() {
        PublishProcessor<Object> pp = PublishProcessor.create();

        TestObserver<Integer> to = Maybe.just(1)
        .delay(pp).test();


            

Reported by PMD.

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

Line: 37

                  public void justWithOnNext() {
        PublishProcessor<Object> pp = PublishProcessor.create();

        TestObserver<Integer> to = Maybe.just(1)
        .delay(pp).test();

        to.assertEmpty();

        assertTrue(pp.hasSubscribers());

            

Reported by PMD.

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

Line: 37

                  public void justWithOnNext() {
        PublishProcessor<Object> pp = PublishProcessor.create();

        TestObserver<Integer> to = Maybe.just(1)
        .delay(pp).test();

        to.assertEmpty();

        assertTrue(pp.hasSubscribers());

            

Reported by PMD.

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

Line: 40

                      TestObserver<Integer> to = Maybe.just(1)
        .delay(pp).test();

        to.assertEmpty();

        assertTrue(pp.hasSubscribers());

        pp.onNext(1);


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 42

              
        to.assertEmpty();

        assertTrue(pp.hasSubscribers());

        pp.onNext(1);

        assertFalse(pp.hasSubscribers());


            

Reported by PMD.

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

Line: 42

              
        to.assertEmpty();

        assertTrue(pp.hasSubscribers());

        pp.onNext(1);

        assertFalse(pp.hasSubscribers());


            

Reported by PMD.

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

Line: 44

              
        assertTrue(pp.hasSubscribers());

        pp.onNext(1);

        assertFalse(pp.hasSubscribers());

        to.assertResult(1);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 46

              
        pp.onNext(1);

        assertFalse(pp.hasSubscribers());

        to.assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 46

              
        pp.onNext(1);

        assertFalse(pp.hasSubscribers());

        to.assertResult(1);
    }

    @Test

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/internal/operators/observable/ObservableWindowTimed.java
95 issues
Avoid reassigning parameters such as 'window'
Design

Line: 453

                          }
        }

        UnicastSubject<T> createNewWindow(UnicastSubject<T> window) {
            if (window != null) {
                window.onComplete();
                window = null;
            }


            

Reported by PMD.

Avoid reassigning parameters such as 'window'
Design

Line: 453

                          }
        }

        UnicastSubject<T> createNewWindow(UnicastSubject<T> window) {
            if (window != null) {
                window.onComplete();
                window = null;
            }


            

Reported by PMD.

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

Line: 31

              import io.reactivex.rxjava3.subjects.UnicastSubject;

public final class ObservableWindowTimed<T> extends AbstractObservableWithUpstream<T, Observable<T>> {
    final long timespan;
    final long timeskip;
    final TimeUnit unit;
    final Scheduler scheduler;
    final long maxSize;
    final int bufferSize;

            

Reported by PMD.

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

Line: 32

              
public final class ObservableWindowTimed<T> extends AbstractObservableWithUpstream<T, Observable<T>> {
    final long timespan;
    final long timeskip;
    final TimeUnit unit;
    final Scheduler scheduler;
    final long maxSize;
    final int bufferSize;
    final boolean restartTimerOnMaxSize;

            

Reported by PMD.

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

Line: 33

              public final class ObservableWindowTimed<T> extends AbstractObservableWithUpstream<T, Observable<T>> {
    final long timespan;
    final long timeskip;
    final TimeUnit unit;
    final Scheduler scheduler;
    final long maxSize;
    final int bufferSize;
    final boolean restartTimerOnMaxSize;


            

Reported by PMD.

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

Line: 34

                  final long timespan;
    final long timeskip;
    final TimeUnit unit;
    final Scheduler scheduler;
    final long maxSize;
    final int bufferSize;
    final boolean restartTimerOnMaxSize;

    public ObservableWindowTimed(Observable<T> source,

            

Reported by PMD.

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

Line: 35

                  final long timeskip;
    final TimeUnit unit;
    final Scheduler scheduler;
    final long maxSize;
    final int bufferSize;
    final boolean restartTimerOnMaxSize;

    public ObservableWindowTimed(Observable<T> source,
            long timespan, long timeskip, TimeUnit unit, Scheduler scheduler, long maxSize,

            

Reported by PMD.

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

Line: 36

                  final TimeUnit unit;
    final Scheduler scheduler;
    final long maxSize;
    final int bufferSize;
    final boolean restartTimerOnMaxSize;

    public ObservableWindowTimed(Observable<T> source,
            long timespan, long timeskip, TimeUnit unit, Scheduler scheduler, long maxSize,
            int bufferSize, boolean restartTimerOnMaxSize) {

            

Reported by PMD.

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

Line: 37

                  final Scheduler scheduler;
    final long maxSize;
    final int bufferSize;
    final boolean restartTimerOnMaxSize;

    public ObservableWindowTimed(Observable<T> source,
            long timespan, long timeskip, TimeUnit unit, Scheduler scheduler, long maxSize,
            int bufferSize, boolean restartTimerOnMaxSize) {
        super(source);

            

Reported by PMD.

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

Line: 76

                  implements Observer<T>, Disposable {
        private static final long serialVersionUID = 5724293814035355511L;

        final Observer<? super Observable<T>> downstream;

        final SimplePlainQueue<Object> queue;

        final long timespan;
        final TimeUnit unit;

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/BlockingFlowableNextTest.java
95 issues
System.out.println is used
Design

Line: 297

              
                assertFalse(it.hasNext());

                System.out.println("a: " + a + " b: " + b + " c: " + c);
                break;
            } catch (AssertionError ex) {
                if (++repeat == 3) {
                    throw ex;
                }

            

Reported by PMD.

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

Line: 35

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

public class BlockingFlowableNextTest extends RxJavaTest {

    private void fireOnNextInNewThread(final FlowableProcessor<String> o, final String value) {
        new Thread() {
            @Override
            public void run() {

            

Reported by PMD.

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

Line: 66

                  }

    @Test
    public void next() {
        FlowableProcessor<String> obs = PublishProcessor.create();
        Iterator<String> it = obs.blockingNext().iterator();
        fireOnNextInNewThread(obs, "one");
        assertTrue(it.hasNext());
        assertEquals("one", it.next());

            

Reported by PMD.

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

Line: 68

                  @Test
    public void next() {
        FlowableProcessor<String> obs = PublishProcessor.create();
        Iterator<String> it = obs.blockingNext().iterator();
        fireOnNextInNewThread(obs, "one");
        assertTrue(it.hasNext());
        assertEquals("one", it.next());

        fireOnNextInNewThread(obs, "two");

            

Reported by PMD.

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

Line: 68

                  @Test
    public void next() {
        FlowableProcessor<String> obs = PublishProcessor.create();
        Iterator<String> it = obs.blockingNext().iterator();
        fireOnNextInNewThread(obs, "one");
        assertTrue(it.hasNext());
        assertEquals("one", it.next());

        fireOnNextInNewThread(obs, "two");

            

Reported by PMD.

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

Line: 69

                  public void next() {
        FlowableProcessor<String> obs = PublishProcessor.create();
        Iterator<String> it = obs.blockingNext().iterator();
        fireOnNextInNewThread(obs, "one");
        assertTrue(it.hasNext());
        assertEquals("one", it.next());

        fireOnNextInNewThread(obs, "two");
        assertTrue(it.hasNext());

            

Reported by PMD.

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

Line: 73

                      assertTrue(it.hasNext());
        assertEquals("one", it.next());

        fireOnNextInNewThread(obs, "two");
        assertTrue(it.hasNext());
        assertEquals("two", it.next());

        fireOnNextInNewThread(obs, "three");
        try {

            

Reported by PMD.

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

Line: 84

                          fail("Calling next() without hasNext() should wait for next fire");
        }

        obs.onComplete();
        assertFalse(it.hasNext());
        try {
            it.next();
            fail("At the end of an iterator should throw a NoSuchElementException");
        } catch (NoSuchElementException e) {

            

Reported by PMD.

The String literal 'At the end of an iterator should throw a NoSuchElementException' appears 6 times in this file; the first occurrence is on line 88
Error

Line: 88

                      assertFalse(it.hasNext());
        try {
            it.next();
            fail("At the end of an iterator should throw a NoSuchElementException");
        } catch (NoSuchElementException e) {
        }

        // If the observable is completed, hasNext always returns false and next always throw a NoSuchElementException.
        assertFalse(it.hasNext());

            

Reported by PMD.

Avoid empty catch blocks
Error

Line: 89

                      try {
            it.next();
            fail("At the end of an iterator should throw a NoSuchElementException");
        } catch (NoSuchElementException e) {
        }

        // If the observable is completed, hasNext always returns false and next always throw a NoSuchElementException.
        assertFalse(it.hasNext());
        try {

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/observers/SafeObserverTest.java
94 issues
This class has a bunch of public methods and attributes
Design

Line: 14

               * the License for the specific language governing permissions and limitations under the License.
 */

package io.reactivex.rxjava3.observers;

import static org.junit.Assert.*;

import java.util.List;
import java.util.concurrent.atomic.AtomicReference;

            

Reported by PMD.

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

Line: 29

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

public class SafeObserverTest extends RxJavaTest {

    @Test
    public void onNextFailure() {
        AtomicReference<Throwable> onError = new AtomicReference<>();
        try {

            

Reported by PMD.

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

Line: 32

              public class SafeObserverTest extends RxJavaTest {

    @Test
    public void onNextFailure() {
        AtomicReference<Throwable> onError = new AtomicReference<>();
        try {
            OBSERVER_ONNEXT_FAIL(onError).onNext("one");
            fail("expects exception to be thrown");
        } catch (Exception e) {

            

Reported by PMD.

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

Line: 35

                  public void onNextFailure() {
        AtomicReference<Throwable> onError = new AtomicReference<>();
        try {
            OBSERVER_ONNEXT_FAIL(onError).onNext("one");
            fail("expects exception to be thrown");
        } catch (Exception e) {
            assertNull(onError.get());
            assertTrue(e instanceof SafeObserverTestException);
            assertEquals("onNextFail", e.getMessage());

            

Reported by PMD.

The String literal 'expects exception to be thrown' appears 4 times in this file; the first occurrence is on line 36
Error

Line: 36

                      AtomicReference<Throwable> onError = new AtomicReference<>();
        try {
            OBSERVER_ONNEXT_FAIL(onError).onNext("one");
            fail("expects exception to be thrown");
        } catch (Exception e) {
            assertNull(onError.get());
            assertTrue(e instanceof SafeObserverTestException);
            assertEquals("onNextFail", e.getMessage());
        }

            

Reported by PMD.

Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block
Design

Line: 37

                      try {
            OBSERVER_ONNEXT_FAIL(onError).onNext("one");
            fail("expects exception to be thrown");
        } catch (Exception e) {
            assertNull(onError.get());
            assertTrue(e instanceof SafeObserverTestException);
            assertEquals("onNextFail", e.getMessage());
        }
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 38

                          OBSERVER_ONNEXT_FAIL(onError).onNext("one");
            fail("expects exception to be thrown");
        } catch (Exception e) {
            assertNull(onError.get());
            assertTrue(e instanceof SafeObserverTestException);
            assertEquals("onNextFail", e.getMessage());
        }
    }


            

Reported by PMD.

An instanceof check is being performed on the caught exception. Create a separate catch clause for this exception type.
Error

Line: 39

                          fail("expects exception to be thrown");
        } catch (Exception e) {
            assertNull(onError.get());
            assertTrue(e instanceof SafeObserverTestException);
            assertEquals("onNextFail", e.getMessage());
        }
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 39

                          fail("expects exception to be thrown");
        } catch (Exception e) {
            assertNull(onError.get());
            assertTrue(e instanceof SafeObserverTestException);
            assertEquals("onNextFail", e.getMessage());
        }
    }

    @Test

            

Reported by PMD.

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

Line: 40

                      } catch (Exception e) {
            assertNull(onError.get());
            assertTrue(e instanceof SafeObserverTestException);
            assertEquals("onNextFail", e.getMessage());
        }
    }

    @Test
    public void onNextFailureSafe() {

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/disposables/DisposableTest.java
94 issues
This class has too many methods, consider refactoring it.
Design

Line: 34

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

public class DisposableTest extends RxJavaTest {

    @Test
    public void unsubscribeOnlyOnce() {
        Runnable run = mock(Runnable.class);


            

Reported by PMD.

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

Line: 37

              public class DisposableTest extends RxJavaTest {

    @Test
    public void unsubscribeOnlyOnce() {
        Runnable run = mock(Runnable.class);

        Disposable d = Disposable.fromRunnable(run);

        assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=false, "));

            

Reported by PMD.

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

Line: 42

              
        Disposable d = Disposable.fromRunnable(run);

        assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=false, "));

        d.dispose();
        assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=true, "));

        d.dispose();

            

Reported by PMD.

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

Line: 42

              
        Disposable d = Disposable.fromRunnable(run);

        assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=false, "));

        d.dispose();
        assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=true, "));

        d.dispose();

            

Reported by PMD.

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

Line: 42

              
        Disposable d = Disposable.fromRunnable(run);

        assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=false, "));

        d.dispose();
        assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=true, "));

        d.dispose();

            

Reported by PMD.

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

Line: 44

              
        assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=false, "));

        d.dispose();
        assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=true, "));

        d.dispose();
        assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=true, "));


            

Reported by PMD.

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

Line: 45

                      assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=false, "));

        d.dispose();
        assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=true, "));

        d.dispose();
        assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=true, "));

        verify(run, times(1)).run();

            

Reported by PMD.

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

Line: 45

                      assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=false, "));

        d.dispose();
        assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=true, "));

        d.dispose();
        assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=true, "));

        verify(run, times(1)).run();

            

Reported by PMD.

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

Line: 45

                      assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=false, "));

        d.dispose();
        assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=true, "));

        d.dispose();
        assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=true, "));

        verify(run, times(1)).run();

            

Reported by PMD.

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

Line: 47

                      d.dispose();
        assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=true, "));

        d.dispose();
        assertTrue(d.toString(), d.toString().contains("RunnableDisposable(disposed=true, "));

        verify(run, times(1)).run();
    }


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMaterializeTest.java
94 issues
Avoid throwing raw exception types.
Design

Line: 47

                      try {
            o1.t.join();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }

        assertFalse(observer.onError);
        assertTrue(observer.onComplete);
        assertEquals(3, observer.notifications.size());

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 75

                      try {
            o1.t.join();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }

        assertFalse(observer.onError);
        assertTrue(observer.onComplete);
        assertEquals(4, observer.notifications.size());

            

Reported by PMD.

System.out.println is used
Design

Line: 160

                              public void run() {
                    for (String s : valuesToReturn) {
                        if (s == null) {
                            System.out.println("throwing exception");
                            try {
                                Thread.sleep(100);
                            } catch (Throwable e) {

                            }

            

Reported by PMD.

System.out.println is used
Design

Line: 172

                                          observer.onNext(s);
                        }
                    }
                    System.out.println("subscription complete");
                    observer.onComplete();
                }

            });
            t.start();

            

Reported by PMD.

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

Line: 34

              public class ObservableMaterializeTest extends RxJavaTest {

    @Test
    public void materialize1() {
        // null will cause onError to be triggered before "three" can be
        // returned
        final TestAsyncErrorObservable o1 = new TestAsyncErrorObservable("one", "two", null,
                "three");


            

Reported by PMD.

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

Line: 37

                  public void materialize1() {
        // null will cause onError to be triggered before "three" can be
        // returned
        final TestAsyncErrorObservable o1 = new TestAsyncErrorObservable("one", "two", null,
                "three");

        TestLocalObserver observer = new TestLocalObserver();
        Observable<Notification<String>> m = Observable.unsafeCreate(o1).materialize();
        m.subscribe(observer);

            

Reported by PMD.

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

Line: 37

                  public void materialize1() {
        // null will cause onError to be triggered before "three" can be
        // returned
        final TestAsyncErrorObservable o1 = new TestAsyncErrorObservable("one", "two", null,
                "three");

        TestLocalObserver observer = new TestLocalObserver();
        Observable<Notification<String>> m = Observable.unsafeCreate(o1).materialize();
        m.subscribe(observer);

            

Reported by PMD.

The String literal 'three' appears 4 times in this file; the first occurrence is on line 38
Error

Line: 38

                      // null will cause onError to be triggered before "three" can be
        // returned
        final TestAsyncErrorObservable o1 = new TestAsyncErrorObservable("one", "two", null,
                "three");

        TestLocalObserver observer = new TestLocalObserver();
        Observable<Notification<String>> m = Observable.unsafeCreate(o1).materialize();
        m.subscribe(observer);


            

Reported by PMD.

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

Line: 41

                              "three");

        TestLocalObserver observer = new TestLocalObserver();
        Observable<Notification<String>> m = Observable.unsafeCreate(o1).materialize();
        m.subscribe(observer);

        try {
            o1.t.join();
        } catch (InterruptedException e) {

            

Reported by PMD.

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

Line: 42

              
        TestLocalObserver observer = new TestLocalObserver();
        Observable<Notification<String>> m = Observable.unsafeCreate(o1).materialize();
        m.subscribe(observer);

        try {
            o1.t.join();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/schedulers/SchedulerTest.java
92 issues
This class has too many methods, consider refactoring it.
Design

Line: 33

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

public class SchedulerTest extends RxJavaTest {

    @Test
    public void defaultPeriodicTask() {
        final int[] count = { 0 };


            

Reported by PMD.

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

Line: 36

              public class SchedulerTest extends RxJavaTest {

    @Test
    public void defaultPeriodicTask() {
        final int[] count = { 0 };

        TestScheduler scheduler = new TestScheduler();

        Disposable d = scheduler.schedulePeriodicallyDirect(new Runnable() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 48

                          }
        }, 100, 100, TimeUnit.MILLISECONDS);

        assertEquals(0, count[0]);
        assertFalse(d.isDisposed());

        scheduler.advanceTimeBy(200, TimeUnit.MILLISECONDS);

        assertEquals(2, count[0]);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 49

                      }, 100, 100, TimeUnit.MILLISECONDS);

        assertEquals(0, count[0]);
        assertFalse(d.isDisposed());

        scheduler.advanceTimeBy(200, TimeUnit.MILLISECONDS);

        assertEquals(2, count[0]);


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 53

              
        scheduler.advanceTimeBy(200, TimeUnit.MILLISECONDS);

        assertEquals(2, count[0]);

        d.dispose();

        assertTrue(d.isDisposed());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 57

              
        d.dispose();

        assertTrue(d.isDisposed());

        scheduler.advanceTimeBy(200, TimeUnit.MILLISECONDS);

        assertEquals(2, count[0]);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 61

              
        scheduler.advanceTimeBy(200, TimeUnit.MILLISECONDS);

        assertEquals(2, count[0]);
    }

    @Test
    public void periodicDirectThrows() throws Throwable {
        TestHelper.withErrorTracking(errors -> {

            

Reported by PMD.

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

Line: 65

                  }

    @Test
    public void periodicDirectThrows() throws Throwable {
        TestHelper.withErrorTracking(errors -> {
            TestScheduler scheduler = new TestScheduler();

            try {
                scheduler.schedulePeriodicallyDirect(new Runnable() {

            

Reported by PMD.

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

Line: 89

                  }

    @Test
    public void disposePeriodicDirect() {
        final int[] count = { 0 };

        TestScheduler scheduler = new TestScheduler();

        Disposable d = scheduler.schedulePeriodicallyDirect(new Runnable() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 103

              
        d.dispose();

        assertEquals(0, count[0]);
        assertTrue(d.isDisposed());

        scheduler.advanceTimeBy(200, TimeUnit.MILLISECONDS);

        assertEquals(0, count[0]);

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleFlatMapIterableFlowableTest.java
92 issues
This class has a bunch of public methods and attributes
Design

Line: 14

               * the License for the specific language governing permissions and limitations under the License.
 */

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

import static org.junit.Assert.*;

import java.util.*;
import java.util.concurrent.TimeUnit;

            

Reported by PMD.

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

Line: 35

              import io.reactivex.rxjava3.subscribers.TestSubscriber;
import io.reactivex.rxjava3.testsupport.*;

public class SingleFlatMapIterableFlowableTest extends RxJavaTest {

    @Test
    public void normal() {

        Single.just(1).flattenAsFlowable(new Function<Integer, Iterable<Integer>>() {

            

Reported by PMD.

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

Line: 38

              public class SingleFlatMapIterableFlowableTest extends RxJavaTest {

    @Test
    public void normal() {

        Single.just(1).flattenAsFlowable(new Function<Integer, Iterable<Integer>>() {
            @Override
            public Iterable<Integer> apply(Integer v) throws Exception {
                return Arrays.asList(v, v + 1);

            

Reported by PMD.

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

Line: 51

                  }

    @Test
    public void emptyIterable() {

        Single.just(1).flattenAsFlowable(new Function<Integer, Iterable<Integer>>() {
            @Override
            public Iterable<Integer> apply(Integer v) throws Exception {
                return Collections.<Integer>emptyList();

            

Reported by PMD.

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

Line: 64

                  }

    @Test
    public void error() {

        Single.<Integer>error(new TestException()).flattenAsFlowable(new Function<Integer, Iterable<Integer>>() {
            @Override
            public Iterable<Integer> apply(Integer v) throws Exception {
                return Arrays.asList(v, v + 1);

            

Reported by PMD.

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

Line: 77

                  }

    @Test
    public void backpressure() {

        TestSubscriber<Integer> ts = Single.just(1).flattenAsFlowable(new Function<Integer, Iterable<Integer>>() {
            @Override
            public Iterable<Integer> apply(Integer v) throws Exception {
                return Arrays.asList(v, v + 1);

            

Reported by PMD.

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

Line: 99

                  }

    @Test
    public void take() {
        Single.just(1).flattenAsFlowable(new Function<Integer, Iterable<Integer>>() {
            @Override
            public Iterable<Integer> apply(Integer v) throws Exception {
                return Arrays.asList(v, v + 1);
            }

            

Reported by PMD.

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

Line: 112

                  }

    @Test
    public void fused() {
        TestSubscriberEx<Integer> ts = new TestSubscriberEx<Integer>().setInitialFusionMode(QueueFuseable.ANY);

        Single.just(1).flattenAsFlowable(new Function<Integer, Iterable<Integer>>() {
            @Override
            public Iterable<Integer> apply(Integer v) throws Exception {

            

Reported by PMD.

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

Line: 123

                      })
        .subscribe(ts);

        ts.assertFuseable()
        .assertFusionMode(QueueFuseable.ASYNC)
        .assertResult(1, 2);
        ;
    }


            

Reported by PMD.

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

Line: 123

                      })
        .subscribe(ts);

        ts.assertFuseable()
        .assertFusionMode(QueueFuseable.ASYNC)
        .assertResult(1, 2);
        ;
    }


            

Reported by PMD.