The following issues were found

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

Line: 98

                          @Override
            public Integer apply(String t1) {
                if ("bb".equals(t1)) {
                    throw new RuntimeException("Forced Failure");
                }
                return t1.length();
            }
        };
        Observable<Map<Integer, String>> mapped = source.toMap(lengthFuncErr).toObservable();

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 127

                          @Override
            public String apply(String t1) {
                if ("bb".equals(t1)) {
                    throw new RuntimeException("Forced failure");
                }
                return t1 + t1;
            }
        };


            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 200

                      Supplier<Map<Integer, String>> mapFactory = new Supplier<Map<Integer, String>>() {
            @Override
            public Map<Integer, String> get() {
                throw new RuntimeException("Forced failure");
            }
        };

        Function<String, Integer> lengthFunc = new Function<String, Integer>() {
            @Override

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 273

                          @Override
            public Integer apply(String t1) {
                if ("bb".equals(t1)) {
                    throw new RuntimeException("Forced Failure");
                }
                return t1.length();
            }
        };
        Single<Map<Integer, String>> mapped = source.toMap(lengthFuncErr);

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 301

                          @Override
            public String apply(String t1) {
                if ("bb".equals(t1)) {
                    throw new RuntimeException("Forced failure");
                }
                return t1 + t1;
            }
        };


            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 372

                      Supplier<Map<Integer, String>> mapFactory = new Supplier<Map<Integer, String>>() {
            @Override
            public Map<Integer, String> get() {
                throw new RuntimeException("Forced failure");
            }
        };

        Function<String, Integer> lengthFunc = new Function<String, Integer>() {
            @Override

            

Reported by PMD.

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

Line: 29

              import io.reactivex.rxjava3.functions.*;
import io.reactivex.rxjava3.testsupport.TestHelper;

public class ObservableToMapTest extends RxJavaTest {
    Observer<Object> objectObserver;
    SingleObserver<Object> singleObserver;

    @Before
    public void before() {

            

Reported by PMD.

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

Line: 30

              import io.reactivex.rxjava3.testsupport.TestHelper;

public class ObservableToMapTest extends RxJavaTest {
    Observer<Object> objectObserver;
    SingleObserver<Object> singleObserver;

    @Before
    public void before() {
        objectObserver = TestHelper.mockObserver();

            

Reported by PMD.

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

Line: 31

              
public class ObservableToMapTest extends RxJavaTest {
    Observer<Object> objectObserver;
    SingleObserver<Object> singleObserver;

    @Before
    public void before() {
        objectObserver = TestHelper.mockObserver();
        singleObserver = TestHelper.mockSingleObserver();

            

Reported by PMD.

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

Line: 39

                      singleObserver = TestHelper.mockSingleObserver();
    }

    Function<String, Integer> lengthFunc = new Function<String, Integer>() {
        @Override
        public Integer apply(String t1) {
            return t1.length();
        }
    };

            

Reported by PMD.

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

Line: 35

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

public class FlowableMergeWithSingleTest extends RxJavaTest {

    @Test
    public void normal() {
        Flowable.range(1, 5)
        .mergeWith(Single.just(100))

            

Reported by PMD.

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

Line: 38

              public class FlowableMergeWithSingleTest extends RxJavaTest {

    @Test
    public void normal() {
        Flowable.range(1, 5)
        .mergeWith(Single.just(100))
        .test()
        .assertResult(1, 2, 3, 4, 5, 100);
    }

            

Reported by PMD.

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

Line: 39

              
    @Test
    public void normal() {
        Flowable.range(1, 5)
        .mergeWith(Single.just(100))
        .test()
        .assertResult(1, 2, 3, 4, 5, 100);
    }


            

Reported by PMD.

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

Line: 39

              
    @Test
    public void normal() {
        Flowable.range(1, 5)
        .mergeWith(Single.just(100))
        .test()
        .assertResult(1, 2, 3, 4, 5, 100);
    }


            

Reported by PMD.

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

Line: 39

              
    @Test
    public void normal() {
        Flowable.range(1, 5)
        .mergeWith(Single.just(100))
        .test()
        .assertResult(1, 2, 3, 4, 5, 100);
    }


            

Reported by PMD.

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

Line: 46

                  }

    @Test
    public void normalLong() {
        Flowable.range(1, 512)
        .mergeWith(Single.just(100))
        .test()
        .assertValueCount(513)
        .assertComplete();

            

Reported by PMD.

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

Line: 47

              
    @Test
    public void normalLong() {
        Flowable.range(1, 512)
        .mergeWith(Single.just(100))
        .test()
        .assertValueCount(513)
        .assertComplete();
    }

            

Reported by PMD.

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

Line: 47

              
    @Test
    public void normalLong() {
        Flowable.range(1, 512)
        .mergeWith(Single.just(100))
        .test()
        .assertValueCount(513)
        .assertComplete();
    }

            

Reported by PMD.

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

Line: 47

              
    @Test
    public void normalLong() {
        Flowable.range(1, 512)
        .mergeWith(Single.just(100))
        .test()
        .assertValueCount(513)
        .assertComplete();
    }

            

Reported by PMD.

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

Line: 47

              
    @Test
    public void normalLong() {
        Flowable.range(1, 512)
        .mergeWith(Single.just(100))
        .test()
        .assertValueCount(513)
        .assertComplete();
    }

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/mixed/FlowableSwitchMapCompletableTest.java
122 issues
This class has too many methods, consider refactoring it.
Design

Line: 34

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

public class FlowableSwitchMapCompletableTest extends RxJavaTest {

    @Test
    public void normal() {
        Flowable.range(1, 10)
        .switchMapCompletable(new Function<Integer, CompletableSource>() {

            

Reported by PMD.

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

Line: 37

              public class FlowableSwitchMapCompletableTest extends RxJavaTest {

    @Test
    public void normal() {
        Flowable.range(1, 10)
        .switchMapCompletable(new Function<Integer, CompletableSource>() {
            @Override
            public CompletableSource apply(Integer v) throws Exception {
                return Completable.complete();

            

Reported by PMD.

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

Line: 50

                  }

    @Test
    public void mainError() {
        Flowable.<Integer>error(new TestException())
        .switchMapCompletable(new Function<Integer, CompletableSource>() {
            @Override
            public CompletableSource apply(Integer v) throws Exception {
                return Completable.complete();

            

Reported by PMD.

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

Line: 63

                  }

    @Test
    public void innerError() {
        PublishProcessor<Integer> pp = PublishProcessor.create();
        CompletableSubject cs = CompletableSubject.create();

        TestObserver<Void> to = pp.switchMapCompletable(Functions.justFunction(cs))
        .test();

            

Reported by PMD.

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

Line: 67

                      PublishProcessor<Integer> pp = PublishProcessor.create();
        CompletableSubject cs = CompletableSubject.create();

        TestObserver<Void> to = pp.switchMapCompletable(Functions.justFunction(cs))
        .test();

        assertTrue(pp.hasSubscribers());
        assertFalse(cs.hasObservers());


            

Reported by PMD.

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

Line: 67

                      PublishProcessor<Integer> pp = PublishProcessor.create();
        CompletableSubject cs = CompletableSubject.create();

        TestObserver<Void> to = pp.switchMapCompletable(Functions.justFunction(cs))
        .test();

        assertTrue(pp.hasSubscribers());
        assertFalse(cs.hasObservers());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 70

                      TestObserver<Void> to = pp.switchMapCompletable(Functions.justFunction(cs))
        .test();

        assertTrue(pp.hasSubscribers());
        assertFalse(cs.hasObservers());

        pp.onNext(1);

        assertTrue(cs.hasObservers());

            

Reported by PMD.

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

Line: 70

                      TestObserver<Void> to = pp.switchMapCompletable(Functions.justFunction(cs))
        .test();

        assertTrue(pp.hasSubscribers());
        assertFalse(cs.hasObservers());

        pp.onNext(1);

        assertTrue(cs.hasObservers());

            

Reported by PMD.

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

Line: 71

                      .test();

        assertTrue(pp.hasSubscribers());
        assertFalse(cs.hasObservers());

        pp.onNext(1);

        assertTrue(cs.hasObservers());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 71

                      .test();

        assertTrue(pp.hasSubscribers());
        assertFalse(cs.hasObservers());

        pp.onNext(1);

        assertTrue(cs.hasObservers());


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/subjects/CompletableSubjectTest.java
121 issues
JUnit tests should include assert() or fail()
Design

Line: 33

              public class CompletableSubjectTest extends RxJavaTest {

    @Test
    public void once() {
        CompletableSubject cs = CompletableSubject.create();

        TestObserver<Void> to = cs.test();

        cs.onComplete();

            

Reported by PMD.

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

Line: 36

                  public void once() {
        CompletableSubject cs = CompletableSubject.create();

        TestObserver<Void> to = cs.test();

        cs.onComplete();

        List<Throwable> errors = TestHelper.trackPluginErrors();
        try {

            

Reported by PMD.

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

Line: 38

              
        TestObserver<Void> to = cs.test();

        cs.onComplete();

        List<Throwable> errors = TestHelper.trackPluginErrors();
        try {
            cs.onError(new IOException());


            

Reported by PMD.

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

Line: 48

                      } finally {
            RxJavaPlugins.reset();
        }
        cs.onComplete();

        to.assertResult();
    }

    @Test

            

Reported by PMD.

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

Line: 50

                      }
        cs.onComplete();

        to.assertResult();
    }

    @Test
    public void error() {
        CompletableSubject cs = CompletableSubject.create();

            

Reported by PMD.

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

Line: 54

                  }

    @Test
    public void error() {
        CompletableSubject cs = CompletableSubject.create();

        assertFalse(cs.hasComplete());
        assertFalse(cs.hasThrowable());
        assertNull(cs.getThrowable());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 57

                  public void error() {
        CompletableSubject cs = CompletableSubject.create();

        assertFalse(cs.hasComplete());
        assertFalse(cs.hasThrowable());
        assertNull(cs.getThrowable());
        assertFalse(cs.hasObservers());
        assertEquals(0, cs.observerCount());


            

Reported by PMD.

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

Line: 57

                  public void error() {
        CompletableSubject cs = CompletableSubject.create();

        assertFalse(cs.hasComplete());
        assertFalse(cs.hasThrowable());
        assertNull(cs.getThrowable());
        assertFalse(cs.hasObservers());
        assertEquals(0, cs.observerCount());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 58

                      CompletableSubject cs = CompletableSubject.create();

        assertFalse(cs.hasComplete());
        assertFalse(cs.hasThrowable());
        assertNull(cs.getThrowable());
        assertFalse(cs.hasObservers());
        assertEquals(0, cs.observerCount());

        TestObserver<Void> to = cs.test();

            

Reported by PMD.

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

Line: 58

                      CompletableSubject cs = CompletableSubject.create();

        assertFalse(cs.hasComplete());
        assertFalse(cs.hasThrowable());
        assertNull(cs.getThrowable());
        assertFalse(cs.hasObservers());
        assertEquals(0, cs.observerCount());

        TestObserver<Void> to = cs.test();

            

Reported by PMD.

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

Line: 33

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

public class FlowableSkipLastTimedTest extends RxJavaTest {

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


            

Reported by PMD.

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

Line: 42

                      PublishProcessor<Integer> source = PublishProcessor.create();

        // FIXME the timeunit now matters due to rounding
        Flowable<Integer> result = source.skipLast(1000, TimeUnit.MILLISECONDS, scheduler);

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

        result.subscribe(subscriber);


            

Reported by PMD.

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

Line: 46

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

        result.subscribe(subscriber);

        source.onNext(1);
        source.onNext(2);
        source.onNext(3);


            

Reported by PMD.

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

Line: 48

              
        result.subscribe(subscriber);

        source.onNext(1);
        source.onNext(2);
        source.onNext(3);

        scheduler.advanceTimeBy(500, TimeUnit.MILLISECONDS);


            

Reported by PMD.

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

Line: 49

                      result.subscribe(subscriber);

        source.onNext(1);
        source.onNext(2);
        source.onNext(3);

        scheduler.advanceTimeBy(500, TimeUnit.MILLISECONDS);

        source.onNext(4);

            

Reported by PMD.

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

Line: 50

              
        source.onNext(1);
        source.onNext(2);
        source.onNext(3);

        scheduler.advanceTimeBy(500, TimeUnit.MILLISECONDS);

        source.onNext(4);
        source.onNext(5);

            

Reported by PMD.

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

Line: 54

              
        scheduler.advanceTimeBy(500, TimeUnit.MILLISECONDS);

        source.onNext(4);
        source.onNext(5);
        source.onNext(6);

        scheduler.advanceTimeBy(950, TimeUnit.MILLISECONDS);
        source.onComplete();

            

Reported by PMD.

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

Line: 55

                      scheduler.advanceTimeBy(500, TimeUnit.MILLISECONDS);

        source.onNext(4);
        source.onNext(5);
        source.onNext(6);

        scheduler.advanceTimeBy(950, TimeUnit.MILLISECONDS);
        source.onComplete();


            

Reported by PMD.

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

Line: 56

              
        source.onNext(4);
        source.onNext(5);
        source.onNext(6);

        scheduler.advanceTimeBy(950, TimeUnit.MILLISECONDS);
        source.onComplete();

        InOrder inOrder = inOrder(subscriber);

            

Reported by PMD.

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

Line: 59

                      source.onNext(6);

        scheduler.advanceTimeBy(950, TimeUnit.MILLISECONDS);
        source.onComplete();

        InOrder inOrder = inOrder(subscriber);
        inOrder.verify(subscriber).onNext(1);
        inOrder.verify(subscriber).onNext(2);
        inOrder.verify(subscriber).onNext(3);

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/schedulers/AbstractDirectTaskTest.java
121 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 29

              public class AbstractDirectTaskTest extends RxJavaTest {

    @Test
    public void cancelSetFuture() {
        AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE, true) {
            private static final long serialVersionUID = 208585707945686116L;
        };
        final Boolean[] interrupted = { null };


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 35

                      };
        final Boolean[] interrupted = { null };

        assertFalse(task.isDisposed());

        task.dispose();

        assertTrue(task.isDisposed());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 39

              
        task.dispose();

        assertTrue(task.isDisposed());

        task.dispose();

        assertTrue(task.isDisposed());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 43

              
        task.dispose();

        assertTrue(task.isDisposed());

        FutureTask<Void> ft = new FutureTask<Void>(Functions.EMPTY_RUNNABLE, null) {
            @Override
            public boolean cancel(boolean mayInterruptIfRunning) {
                interrupted[0] = mayInterruptIfRunning;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 54

                      };
        task.setFuture(ft);

        assertTrue(interrupted[0]);

        assertTrue(task.isDisposed());
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 56

              
        assertTrue(interrupted[0]);

        assertTrue(task.isDisposed());
    }

    @Test
    public void cancelSetFutureCurrentThread() {
        AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE, true) {

            

Reported by PMD.

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

Line: 60

                  }

    @Test
    public void cancelSetFutureCurrentThread() {
        AbstractDirectTask task = new AbstractDirectTask(Functions.EMPTY_RUNNABLE, true) {
            private static final long serialVersionUID = 208585707945686116L;
        };
        final Boolean[] interrupted = { null };


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 66

                      };
        final Boolean[] interrupted = { null };

        assertFalse(task.isDisposed());

        task.runner = Thread.currentThread();

        task.dispose();


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 72

              
        task.dispose();

        assertTrue(task.isDisposed());

        task.dispose();

        assertTrue(task.isDisposed());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 76

              
        task.dispose();

        assertTrue(task.isDisposed());

        FutureTask<Void> ft = new FutureTask<Void>(Functions.EMPTY_RUNNABLE, null) {
            @Override
            public boolean cancel(boolean mayInterruptIfRunning) {
                interrupted[0] = mayInterruptIfRunning;

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/processors/ReplayProcessorBoundedConcurrencyTest.java
121 issues
Avoid throwing raw exception types.
Design

Line: 220

                      if (success) {
            System.out.println("Success! " + sums.size() + " each had the same sum of " + expected);
        } else {
            throw new RuntimeException("Concurrency Bug");
        }

    }

    /**

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 275

                              t4.join();
                t5.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }

            assertEquals("value", value1.get());
            assertEquals("value", t2.value.get());
            assertEquals("value", t3.value.get());

            

Reported by PMD.

System.out.println is used
Design

Line: 44

              
                    @Override
                    public void subscribe(Subscriber<? super Long> subscriber) {
                        System.out.println("********* Start Source Data ***********");
                        for (long l = 1; l <= 10000; l++) {
                            subscriber.onNext(l);
                        }
                        System.out.println("********* Finished Source Data ***********");
                        subscriber.onComplete();

            

Reported by PMD.

System.out.println is used
Design

Line: 48

                                      for (long l = 1; l <= 10000; l++) {
                            subscriber.onNext(l);
                        }
                        System.out.println("********* Finished Source Data ***********");
                        subscriber.onComplete();
                    }
                }).subscribe(replay);
            }
        });

            

Reported by PMD.

System.out.println is used
Design

Line: 69

              
                    @Override
                    public void onComplete() {
                        System.out.println("*** Slow Observer completed");
                        slowLatch.countDown();
                    }

                    @Override
                    public void onError(Throwable e) {

            

Reported by PMD.

System.out.println is used
Design

Line: 80

                                  @Override
                    public void onNext(Long args) {
                        if (args == 1) {
                            System.out.println("*** Slow Observer STARTED");
                        }
                        try {
                            if (args % 10 == 0) {
                                Thread.sleep(1);
                            }

            

Reported by PMD.

System.out.println is used
Design

Line: 110

              
                    @Override
                    public void onComplete() {
                        System.out.println("*** Fast Observer completed");
                        fastLatch.countDown();
                    }

                    @Override
                    public void onError(Throwable e) {

            

Reported by PMD.

System.out.println is used
Design

Line: 121

                                  @Override
                    public void onNext(Long args) {
                        if (args == 1) {
                            System.out.println("*** Fast Observer STARTED");
                        }
                    }
                };
                replay.subscribe(fast);
                try {

            

Reported by PMD.

System.out.println is used
Design

Line: 153

              
                    @Override
                    public void subscribe(Subscriber<? super Long> subscriber) {
                        System.out.println("********* Start Source Data ***********");
                        for (long l = 1; l <= 10000; l++) {
                            subscriber.onNext(l);
                        }
                        System.out.println("********* Finished Source Data ***********");
                        subscriber.onComplete();

            

Reported by PMD.

System.out.println is used
Design

Line: 157

                                      for (long l = 1; l <= 10000; l++) {
                            subscriber.onNext(l);
                        }
                        System.out.println("********* Finished Source Data ***********");
                        subscriber.onComplete();
                    }
                }).subscribe(replay);
            }
        });

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableAmbTest.java
120 issues
This class has too many methods, consider refactoring it.
Design

Line: 40

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

public class ObservableAmbTest extends RxJavaTest {

    private TestScheduler scheduler;
    private Scheduler.Worker innerScheduler;

    @Before

            

Reported by PMD.

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

Line: 42

              
public class ObservableAmbTest extends RxJavaTest {

    private TestScheduler scheduler;
    private Scheduler.Worker innerScheduler;

    @Before
    public void setUp() {
        scheduler = new TestScheduler();

            

Reported by PMD.

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

Line: 43

              public class ObservableAmbTest extends RxJavaTest {

    private TestScheduler scheduler;
    private Scheduler.Worker innerScheduler;

    @Before
    public void setUp() {
        scheduler = new TestScheduler();
        innerScheduler = scheduler.createWorker();

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 63

              
                long delay = interval;
                for (final String value : values) {
                    parentSubscription.add(innerScheduler.schedule(new Runnable() {
                        @Override
                        public void run() {
                            observer.onNext(value);
                        }
                    }

            

Reported by PMD.

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

Line: 91

                      Observable<String> observable1 = createObservable(new String[] {
                "1", "11", "111", "1111" }, 2000, null);
        Observable<String> observable2 = createObservable(new String[] {
                "2", "22", "222", "2222" }, 1000, null);
        Observable<String> observable3 = createObservable(new String[] {
                "3", "33", "333", "3333" }, 3000, null);

        Observable<String> o = Observable.ambArray(observable1,
                observable2, observable3);

            

Reported by PMD.

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

Line: 91

                      Observable<String> observable1 = createObservable(new String[] {
                "1", "11", "111", "1111" }, 2000, null);
        Observable<String> observable2 = createObservable(new String[] {
                "2", "22", "222", "2222" }, 1000, null);
        Observable<String> observable3 = createObservable(new String[] {
                "3", "33", "333", "3333" }, 3000, null);

        Observable<String> o = Observable.ambArray(observable1,
                observable2, observable3);

            

Reported by PMD.

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

Line: 99

                              observable2, observable3);

        Observer<String> observer = TestHelper.mockObserver();
        o.subscribe(observer);

        scheduler.advanceTimeBy(100000, TimeUnit.MILLISECONDS);

        InOrder inOrder = inOrder(observer);
        inOrder.verify(observer, times(1)).onNext("2");

            

Reported by PMD.

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

Line: 104

                      scheduler.advanceTimeBy(100000, TimeUnit.MILLISECONDS);

        InOrder inOrder = inOrder(observer);
        inOrder.verify(observer, times(1)).onNext("2");
        inOrder.verify(observer, times(1)).onNext("22");
        inOrder.verify(observer, times(1)).onNext("222");
        inOrder.verify(observer, times(1)).onNext("2222");
        inOrder.verify(observer, times(1)).onComplete();
        inOrder.verifyNoMoreInteractions();

            

Reported by PMD.

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

Line: 104

                      scheduler.advanceTimeBy(100000, TimeUnit.MILLISECONDS);

        InOrder inOrder = inOrder(observer);
        inOrder.verify(observer, times(1)).onNext("2");
        inOrder.verify(observer, times(1)).onNext("22");
        inOrder.verify(observer, times(1)).onNext("222");
        inOrder.verify(observer, times(1)).onNext("2222");
        inOrder.verify(observer, times(1)).onComplete();
        inOrder.verifyNoMoreInteractions();

            

Reported by PMD.

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

Line: 105

              
        InOrder inOrder = inOrder(observer);
        inOrder.verify(observer, times(1)).onNext("2");
        inOrder.verify(observer, times(1)).onNext("22");
        inOrder.verify(observer, times(1)).onNext("222");
        inOrder.verify(observer, times(1)).onNext("2222");
        inOrder.verify(observer, times(1)).onComplete();
        inOrder.verifyNoMoreInteractions();
    }

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/subjects/ReplaySubjectBoundedConcurrencyTest.java
120 issues
Avoid throwing raw exception types.
Design

Line: 224

                      if (success) {
            System.out.println("Success! " + sums.size() + " each had the same sum of " + expected);
        } else {
            throw new RuntimeException("Concurrency Bug");
        }

    }

    /**

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 279

                              t4.join();
                t5.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }

            assertEquals("value", value1.get());
            assertEquals("value", t2.value.get());
            assertEquals("value", t3.value.get());

            

Reported by PMD.

System.out.println is used
Design

Line: 47

                                  @Override
                    public void subscribe(Observer<? super Long> o) {
                        o.onSubscribe(Disposable.empty());
                        System.out.println("********* Start Source Data ***********");
                        for (long l = 1; l <= 10000; l++) {
                            o.onNext(l);
                        }
                        System.out.println("********* Finished Source Data ***********");
                        o.onComplete();

            

Reported by PMD.

System.out.println is used
Design

Line: 51

                                      for (long l = 1; l <= 10000; l++) {
                            o.onNext(l);
                        }
                        System.out.println("********* Finished Source Data ***********");
                        o.onComplete();
                    }
                }).subscribe(replay);
            }
        });

            

Reported by PMD.

System.out.println is used
Design

Line: 72

              
                    @Override
                    public void onComplete() {
                        System.out.println("*** Slow Observer completed");
                        slowLatch.countDown();
                    }

                    @Override
                    public void onError(Throwable e) {

            

Reported by PMD.

System.out.println is used
Design

Line: 83

                                  @Override
                    public void onNext(Long args) {
                        if (args == 1) {
                            System.out.println("*** Slow Observer STARTED");
                        }
                        try {
                            if (args % 10 == 0) {
                                Thread.sleep(1);
                            }

            

Reported by PMD.

System.out.println is used
Design

Line: 113

              
                    @Override
                    public void onComplete() {
                        System.out.println("*** Fast Observer completed");
                        fastLatch.countDown();
                    }

                    @Override
                    public void onError(Throwable e) {

            

Reported by PMD.

System.out.println is used
Design

Line: 124

                                  @Override
                    public void onNext(Long args) {
                        if (args == 1) {
                            System.out.println("*** Fast Observer STARTED");
                        }
                    }
                };
                replay.subscribe(fast);
                try {

            

Reported by PMD.

System.out.println is used
Design

Line: 157

                                  @Override
                    public void subscribe(Observer<? super Long> o) {
                        o.onSubscribe(Disposable.empty());
                        System.out.println("********* Start Source Data ***********");
                        for (long l = 1; l <= 10000; l++) {
                            o.onNext(l);
                        }
                        System.out.println("********* Finished Source Data ***********");
                        o.onComplete();

            

Reported by PMD.

System.out.println is used
Design

Line: 161

                                      for (long l = 1; l <= 10000; l++) {
                            o.onNext(l);
                        }
                        System.out.println("********* Finished Source Data ***********");
                        o.onComplete();
                    }
                }).subscribe(replay);
            }
        });

            

Reported by PMD.

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

Line: 36

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

public class SchedulerWhenTest extends RxJavaTest {
    @Test
    public void asyncMaxConcurrent() {
        TestScheduler tSched = new TestScheduler();
        SchedulerWhen sched = maxConcurrentScheduler(tSched);
        TestSubscriber<Long> tSub = TestSubscriber.create();

            

Reported by PMD.

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

Line: 38

              
public class SchedulerWhenTest extends RxJavaTest {
    @Test
    public void asyncMaxConcurrent() {
        TestScheduler tSched = new TestScheduler();
        SchedulerWhen sched = maxConcurrentScheduler(tSched);
        TestSubscriber<Long> tSub = TestSubscriber.create();

        asyncWork(sched).subscribe(tSub);

            

Reported by PMD.

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

Line: 43

                      SchedulerWhen sched = maxConcurrentScheduler(tSched);
        TestSubscriber<Long> tSub = TestSubscriber.create();

        asyncWork(sched).subscribe(tSub);

        tSub.assertValueCount(0);

        tSched.advanceTimeBy(0, SECONDS);
        tSub.assertValueCount(0);

            

Reported by PMD.

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

Line: 45

              
        asyncWork(sched).subscribe(tSub);

        tSub.assertValueCount(0);

        tSched.advanceTimeBy(0, SECONDS);
        tSub.assertValueCount(0);

        tSched.advanceTimeBy(1, SECONDS);

            

Reported by PMD.

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

Line: 48

                      tSub.assertValueCount(0);

        tSched.advanceTimeBy(0, SECONDS);
        tSub.assertValueCount(0);

        tSched.advanceTimeBy(1, SECONDS);
        tSub.assertValueCount(2);

        tSched.advanceTimeBy(1, SECONDS);

            

Reported by PMD.

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

Line: 51

                      tSub.assertValueCount(0);

        tSched.advanceTimeBy(1, SECONDS);
        tSub.assertValueCount(2);

        tSched.advanceTimeBy(1, SECONDS);
        tSub.assertValueCount(4);

        tSched.advanceTimeBy(1, SECONDS);

            

Reported by PMD.

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

Line: 54

                      tSub.assertValueCount(2);

        tSched.advanceTimeBy(1, SECONDS);
        tSub.assertValueCount(4);

        tSched.advanceTimeBy(1, SECONDS);
        tSub.assertValueCount(5);
        tSub.assertComplete();


            

Reported by PMD.

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

Line: 57

                      tSub.assertValueCount(4);

        tSched.advanceTimeBy(1, SECONDS);
        tSub.assertValueCount(5);
        tSub.assertComplete();

        sched.dispose();
    }


            

Reported by PMD.

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

Line: 58

              
        tSched.advanceTimeBy(1, SECONDS);
        tSub.assertValueCount(5);
        tSub.assertComplete();

        sched.dispose();
    }

    @Test

            

Reported by PMD.

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

Line: 60

                      tSub.assertValueCount(5);
        tSub.assertComplete();

        sched.dispose();
    }

    @Test
    public void asyncDelaySubscription() {
        final TestScheduler tSched = new TestScheduler();

            

Reported by PMD.