The following issues were found

src/test/java/io/reactivex/rxjava3/internal/observers/LambdaObserverTest.java
77 issues
This class has too many methods, consider refactoring it.
Design

Line: 34

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

public class LambdaObserverTest extends RxJavaTest {

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


            

Reported by PMD.

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

Line: 37

              public class LambdaObserverTest extends RxJavaTest {

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

        LambdaObserver<Object> o = new LambdaObserver<>(new Consumer<Object>() {
            @Override
            public void accept(Object v) throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 63

                          }
        });

        assertFalse(o.isDisposed());

        Observable.just(1).subscribe(o);

        assertTrue(received.toString(), received.get(0) instanceof TestException);
        assertEquals(received.toString(), 1, received.size());

            

Reported by PMD.

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

Line: 65

              
        assertFalse(o.isDisposed());

        Observable.just(1).subscribe(o);

        assertTrue(received.toString(), received.get(0) instanceof TestException);
        assertEquals(received.toString(), 1, received.size());

        assertTrue(o.isDisposed());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 68

                      Observable.just(1).subscribe(o);

        assertTrue(received.toString(), received.get(0) instanceof TestException);
        assertEquals(received.toString(), 1, received.size());

        assertTrue(o.isDisposed());
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 70

                      assertTrue(received.toString(), received.get(0) instanceof TestException);
        assertEquals(received.toString(), 1, received.size());

        assertTrue(o.isDisposed());
    }

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

            

Reported by PMD.

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

Line: 74

                  }

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

        LambdaObserver<Object> o = new LambdaObserver<>(new Consumer<Object>() {
            @Override
            public void accept(Object v) throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 99

                          }
        });

        assertFalse(o.isDisposed());

        Observable.just(1).subscribe(o);

        assertTrue(received.toString(), received.get(0) instanceof TestException);
        assertEquals(received.toString(), 1, received.size());

            

Reported by PMD.

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

Line: 101

              
        assertFalse(o.isDisposed());

        Observable.just(1).subscribe(o);

        assertTrue(received.toString(), received.get(0) instanceof TestException);
        assertEquals(received.toString(), 1, received.size());

        assertTrue(o.isDisposed());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 104

                      Observable.just(1).subscribe(o);

        assertTrue(received.toString(), received.get(0) instanceof TestException);
        assertEquals(received.toString(), 1, received.size());

        assertTrue(o.isDisposed());
    }

    @Test

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/schedulers/AbstractSchedulerConcurrencyTests.java
77 issues
Avoid throwing raw exception types.
Design

Line: 405

                                  // we block the first one so we can assert this executes asynchronously with a count
                    first.await(1000, TimeUnit.SECONDS);
                } catch (InterruptedException e) {
                    throw new RuntimeException("The latch should have released if we are async.", e);
                }

                assertNotEquals(Thread.currentThread().getName(), currentThreadName);
                System.out.println("Thread: " + Thread.currentThread().getName());
                System.out.println("t: " + t);

            

Reported by PMD.

System.out.println is used
Design

Line: 62

                              .subscribe(new DefaultSubscriber<Long>() {
                    @Override
                    public void onComplete() {
                        System.out.println("--- completed");
                    }

                    @Override
                    public void onError(Throwable e) {
                        System.out.println("--- onError");

            

Reported by PMD.

System.out.println is used
Design

Line: 67

              
                    @Override
                    public void onError(Throwable e) {
                        System.out.println("--- onError");
                    }

                    @Override
                    public void onNext(Long args) {
                        if (countReceived.incrementAndGet() == 2) {

            

Reported by PMD.

System.out.println is used
Design

Line: 76

                                          cancel();
                            latch.countDown();
                        }
                        System.out.println("==> Received " + args);
                    }
                });

        latch.await(1000, TimeUnit.MILLISECONDS);


            

Reported by PMD.

System.out.println is used
Design

Line: 82

              
        latch.await(1000, TimeUnit.MILLISECONDS);

        System.out.println("----------- it thinks it is finished ------------------ ");

        int timeout = 10;

        while (timeout-- > 0 && countGenerated.get() != 2) {
            Thread.sleep(100);

            

Reported by PMD.

System.out.println is used
Design

Line: 110

              
                        @Override
                        public void run() {
                            System.out.println("Run: " + i++);
                            if (i == 10) {
                                latch.countDown();
                                try {
                                    // wait for unsubscribe to finish so we are not racing it
                                    unsubscribeLatch.await();

            

Reported by PMD.

System.out.println is used
Design

Line: 158

              
                        @Override
                        public void run() {
                            System.out.println("Run: " + i++);
                            if (i == 10) {
                                inner.dispose();
                            }

                            counter.incrementAndGet();

            

Reported by PMD.

System.out.println is used
Design

Line: 240

                              public void run() {
                    i++;
                    if (i % 100000 == 0) {
                        System.out.println(i + "  Total Memory: " + Runtime.getRuntime().totalMemory() + "  Free: " + Runtime.getRuntime().freeMemory());
                    }
                    if (i < 1000000L) {
                        inner.schedule(this);
                    } else {
                        latch.countDown();

            

Reported by PMD.

System.out.println is used
Design

Line: 269

                              public void run() {
                    i++;
                    if (i % 100000 == 0) {
                        System.out.println(i + "  Total Memory: " + Runtime.getRuntime().totalMemory() + "  Free: " + Runtime.getRuntime().freeMemory());
                    }
                    if (i < 1000000L) {
                        inner.schedule(this);
                    } else {
                        latch.countDown();

            

Reported by PMD.

System.out.println is used
Design

Line: 329

                          ResourceSubscriber<Integer> s = new ResourceSubscriber<Integer>() {
                @Override
                public void onComplete() {
                    System.out.println("Completed");
                    completed.set(true);
                }

                @Override
                public void onError(Throwable e) {

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTakeLastTest.java
77 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.flowable;

import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;


            

Reported by PMD.

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

Line: 36

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

public class FlowableTakeLastTest extends RxJavaTest {

    @Test
    public void takeLastEmpty() {
        Flowable<String> w = Flowable.empty();
        Flowable<String> take = w.takeLast(2);

            

Reported by PMD.

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

Line: 41

                  @Test
    public void takeLastEmpty() {
        Flowable<String> w = Flowable.empty();
        Flowable<String> take = w.takeLast(2);

        Subscriber<String> subscriber = TestHelper.mockSubscriber();
        take.subscribe(subscriber);

        verify(subscriber, never()).onNext(any(String.class));

            

Reported by PMD.

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

Line: 44

                      Flowable<String> take = w.takeLast(2);

        Subscriber<String> subscriber = TestHelper.mockSubscriber();
        take.subscribe(subscriber);

        verify(subscriber, never()).onNext(any(String.class));
        verify(subscriber, never()).onError(any(Throwable.class));
        verify(subscriber, times(1)).onComplete();
    }

            

Reported by PMD.

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

Line: 46

                      Subscriber<String> subscriber = TestHelper.mockSubscriber();
        take.subscribe(subscriber);

        verify(subscriber, never()).onNext(any(String.class));
        verify(subscriber, never()).onError(any(Throwable.class));
        verify(subscriber, times(1)).onComplete();
    }

    @Test

            

Reported by PMD.

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

Line: 47

                      take.subscribe(subscriber);

        verify(subscriber, never()).onNext(any(String.class));
        verify(subscriber, never()).onError(any(Throwable.class));
        verify(subscriber, times(1)).onComplete();
    }

    @Test
    public void takeLast1() {

            

Reported by PMD.

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

Line: 48

              
        verify(subscriber, never()).onNext(any(String.class));
        verify(subscriber, never()).onError(any(Throwable.class));
        verify(subscriber, times(1)).onComplete();
    }

    @Test
    public void takeLast1() {
        Flowable<String> w = Flowable.just("one", "two", "three");

            

Reported by PMD.

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

Line: 53

              
    @Test
    public void takeLast1() {
        Flowable<String> w = Flowable.just("one", "two", "three");
        Flowable<String> take = w.takeLast(2);

        Subscriber<String> subscriber = TestHelper.mockSubscriber();
        InOrder inOrder = inOrder(subscriber);
        take.subscribe(subscriber);

            

Reported by PMD.

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

Line: 54

                  @Test
    public void takeLast1() {
        Flowable<String> w = Flowable.just("one", "two", "three");
        Flowable<String> take = w.takeLast(2);

        Subscriber<String> subscriber = TestHelper.mockSubscriber();
        InOrder inOrder = inOrder(subscriber);
        take.subscribe(subscriber);


            

Reported by PMD.

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

Line: 58

              
        Subscriber<String> subscriber = TestHelper.mockSubscriber();
        InOrder inOrder = inOrder(subscriber);
        take.subscribe(subscriber);

        inOrder.verify(subscriber, times(1)).onNext("two");
        inOrder.verify(subscriber, times(1)).onNext("three");
        verify(subscriber, never()).onNext("one");
        verify(subscriber, never()).onError(any(Throwable.class));

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableSkipTimedTest.java
77 issues
Potential violation of Law of Demeter (object not created locally)
Design

Line: 39

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

        Flowable<Integer> result = source.skip(1, TimeUnit.SECONDS, scheduler);

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

        result.subscribe(subscriber);


            

Reported by PMD.

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

Line: 43

              
        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: 45

              
        result.subscribe(subscriber);

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

        scheduler.advanceTimeBy(1, TimeUnit.SECONDS);


            

Reported by PMD.

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

Line: 46

                      result.subscribe(subscriber);

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

        scheduler.advanceTimeBy(1, TimeUnit.SECONDS);

        source.onNext(4);

            

Reported by PMD.

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

Line: 47

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

        scheduler.advanceTimeBy(1, TimeUnit.SECONDS);

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

            

Reported by PMD.

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

Line: 51

              
        scheduler.advanceTimeBy(1, TimeUnit.SECONDS);

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

        source.onComplete();


            

Reported by PMD.

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

Line: 52

                      scheduler.advanceTimeBy(1, TimeUnit.SECONDS);

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

        source.onComplete();

        InOrder inOrder = inOrder(subscriber);

            

Reported by PMD.

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

Line: 53

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

        source.onComplete();

        InOrder inOrder = inOrder(subscriber);


            

Reported by PMD.

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

Line: 55

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

        source.onComplete();

        InOrder inOrder = inOrder(subscriber);

        inOrder.verify(subscriber, never()).onNext(1);
        inOrder.verify(subscriber, never()).onNext(2);

            

Reported by PMD.

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

Line: 59

              
        InOrder inOrder = inOrder(subscriber);

        inOrder.verify(subscriber, never()).onNext(1);
        inOrder.verify(subscriber, never()).onNext(2);
        inOrder.verify(subscriber, never()).onNext(3);
        inOrder.verify(subscriber).onNext(4);
        inOrder.verify(subscriber).onNext(5);
        inOrder.verify(subscriber).onNext(6);

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableSkipTimedTest.java
77 issues
Potential violation of Law of Demeter (object not created locally)
Design

Line: 38

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

        Observable<Integer> result = source.skip(1, TimeUnit.SECONDS, scheduler);

        Observer<Object> o = TestHelper.mockObserver();

        result.subscribe(o);


            

Reported by PMD.

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

Line: 42

              
        Observer<Object> o = TestHelper.mockObserver();

        result.subscribe(o);

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


            

Reported by PMD.

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

Line: 44

              
        result.subscribe(o);

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

        scheduler.advanceTimeBy(1, TimeUnit.SECONDS);


            

Reported by PMD.

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

Line: 45

                      result.subscribe(o);

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

        scheduler.advanceTimeBy(1, TimeUnit.SECONDS);

        source.onNext(4);

            

Reported by PMD.

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

Line: 46

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

        scheduler.advanceTimeBy(1, TimeUnit.SECONDS);

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

            

Reported by PMD.

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

Line: 50

              
        scheduler.advanceTimeBy(1, TimeUnit.SECONDS);

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

        source.onComplete();


            

Reported by PMD.

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

Line: 51

                      scheduler.advanceTimeBy(1, TimeUnit.SECONDS);

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

        source.onComplete();

        InOrder inOrder = inOrder(o);

            

Reported by PMD.

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

Line: 52

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

        source.onComplete();

        InOrder inOrder = inOrder(o);


            

Reported by PMD.

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

Line: 54

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

        source.onComplete();

        InOrder inOrder = inOrder(o);

        inOrder.verify(o, never()).onNext(1);
        inOrder.verify(o, never()).onNext(2);

            

Reported by PMD.

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

Line: 58

              
        InOrder inOrder = inOrder(o);

        inOrder.verify(o, never()).onNext(1);
        inOrder.verify(o, never()).onNext(2);
        inOrder.verify(o, never()).onNext(3);
        inOrder.verify(o).onNext(4);
        inOrder.verify(o).onNext(5);
        inOrder.verify(o).onNext(6);

            

Reported by PMD.

src/jmh/java/io/reactivex/rxjava3/core/XMapYPerf.java
77 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.core;

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

import org.openjdk.jmh.annotations.*;

            

Reported by PMD.

The class 'XMapYPerf' has a Modified Cyclomatic Complexity of 2 (Highest = 33).
Design

Line: 31

              @OutputTimeUnit(TimeUnit.SECONDS)
@Fork(value = 1)
@State(Scope.Thread)
public class XMapYPerf {
    @Param({ "1", "10", "100", "1000", "10000", "100000", "1000000" })
    public int times;

    Flowable<Integer> flowFlatMapIterable1;


            

Reported by PMD.

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

Line: 31

              @OutputTimeUnit(TimeUnit.SECONDS)
@Fork(value = 1)
@State(Scope.Thread)
public class XMapYPerf {
    @Param({ "1", "10", "100", "1000", "10000", "100000", "1000000" })
    public int times;

    Flowable<Integer> flowFlatMapIterable1;


            

Reported by PMD.

Too many fields
Design

Line: 31

              @OutputTimeUnit(TimeUnit.SECONDS)
@Fork(value = 1)
@State(Scope.Thread)
public class XMapYPerf {
    @Param({ "1", "10", "100", "1000", "10000", "100000", "1000000" })
    public int times;

    Flowable<Integer> flowFlatMapIterable1;


            

Reported by PMD.

The class 'XMapYPerf' has a Standard Cyclomatic Complexity of 2 (Highest = 33).
Design

Line: 31

              @OutputTimeUnit(TimeUnit.SECONDS)
@Fork(value = 1)
@State(Scope.Thread)
public class XMapYPerf {
    @Param({ "1", "10", "100", "1000", "10000", "100000", "1000000" })
    public int times;

    Flowable<Integer> flowFlatMapIterable1;


            

Reported by PMD.

The class 'XMapYPerf' is suspected to be a Data Class (WOC=3.448%, NOPA=1, NOAM=28, WMC=29)
Design

Line: 31

              @OutputTimeUnit(TimeUnit.SECONDS)
@Fork(value = 1)
@State(Scope.Thread)
public class XMapYPerf {
    @Param({ "1", "10", "100", "1000", "10000", "100000", "1000000" })
    public int times;

    Flowable<Integer> flowFlatMapIterable1;


            

Reported by PMD.

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

Line: 33

              @State(Scope.Thread)
public class XMapYPerf {
    @Param({ "1", "10", "100", "1000", "10000", "100000", "1000000" })
    public int times;

    Flowable<Integer> flowFlatMapIterable1;

    Flowable<Integer> flowFlatMapIterable0;


            

Reported by PMD.

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

Line: 35

                  @Param({ "1", "10", "100", "1000", "10000", "100000", "1000000" })
    public int times;

    Flowable<Integer> flowFlatMapIterable1;

    Flowable<Integer> flowFlatMapIterable0;

    Flowable<Integer> flowFlatMapFlowable0;


            

Reported by PMD.

Field flowFlatMapIterable1 has the same name as a method
Error

Line: 35

                  @Param({ "1", "10", "100", "1000", "10000", "100000", "1000000" })
    public int times;

    Flowable<Integer> flowFlatMapIterable1;

    Flowable<Integer> flowFlatMapIterable0;

    Flowable<Integer> flowFlatMapFlowable0;


            

Reported by PMD.

Field flowFlatMapIterable0 has the same name as a method
Error

Line: 37

              
    Flowable<Integer> flowFlatMapIterable1;

    Flowable<Integer> flowFlatMapIterable0;

    Flowable<Integer> flowFlatMapFlowable0;

    Flowable<Integer> flowFlatMapFlowable1;


            

Reported by PMD.

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

Line: 34

              public class CompletableTakeUntilTest extends RxJavaTest {

    @Test
    public void consumerDisposes() {
        CompletableSubject cs1 = CompletableSubject.create();
        CompletableSubject cs2 = CompletableSubject.create();

        TestObserver<Void> to = cs1.takeUntil(cs2).test();


            

Reported by PMD.

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

Line: 38

                      CompletableSubject cs1 = CompletableSubject.create();
        CompletableSubject cs2 = CompletableSubject.create();

        TestObserver<Void> to = cs1.takeUntil(cs2).test();

        to.assertEmpty();

        assertTrue(cs1.hasObservers());
        assertTrue(cs2.hasObservers());

            

Reported by PMD.

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

Line: 38

                      CompletableSubject cs1 = CompletableSubject.create();
        CompletableSubject cs2 = CompletableSubject.create();

        TestObserver<Void> to = cs1.takeUntil(cs2).test();

        to.assertEmpty();

        assertTrue(cs1.hasObservers());
        assertTrue(cs2.hasObservers());

            

Reported by PMD.

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

Line: 40

              
        TestObserver<Void> to = cs1.takeUntil(cs2).test();

        to.assertEmpty();

        assertTrue(cs1.hasObservers());
        assertTrue(cs2.hasObservers());

        to.dispose();

            

Reported by PMD.

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

Line: 42

              
        to.assertEmpty();

        assertTrue(cs1.hasObservers());
        assertTrue(cs2.hasObservers());

        to.dispose();

        assertFalse(cs1.hasObservers());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 42

              
        to.assertEmpty();

        assertTrue(cs1.hasObservers());
        assertTrue(cs2.hasObservers());

        to.dispose();

        assertFalse(cs1.hasObservers());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 43

                      to.assertEmpty();

        assertTrue(cs1.hasObservers());
        assertTrue(cs2.hasObservers());

        to.dispose();

        assertFalse(cs1.hasObservers());
        assertFalse(cs2.hasObservers());

            

Reported by PMD.

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

Line: 43

                      to.assertEmpty();

        assertTrue(cs1.hasObservers());
        assertTrue(cs2.hasObservers());

        to.dispose();

        assertFalse(cs1.hasObservers());
        assertFalse(cs2.hasObservers());

            

Reported by PMD.

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

Line: 45

                      assertTrue(cs1.hasObservers());
        assertTrue(cs2.hasObservers());

        to.dispose();

        assertFalse(cs1.hasObservers());
        assertFalse(cs2.hasObservers());
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 47

              
        to.dispose();

        assertFalse(cs1.hasObservers());
        assertFalse(cs2.hasObservers());
    }

    @Test
    public void mainCompletes() {

            

Reported by PMD.

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

Line: 31

              
public class CompletableCacheTest extends RxJavaTest implements Consumer<Object>, Action {

    volatile int count;

    @Override
    public void accept(Object t) throws Exception {
        count++;
    }

            

Reported by PMD.

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

Line: 44

                  }

    @Test
    public void normal() {
        Completable c = Completable.complete()
        .doOnSubscribe(this)
        .cache();

        assertEquals(0, count);

            

Reported by PMD.

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

Line: 45

              
    @Test
    public void normal() {
        Completable c = Completable.complete()
        .doOnSubscribe(this)
        .cache();

        assertEquals(0, count);


            

Reported by PMD.

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

Line: 45

              
    @Test
    public void normal() {
        Completable c = Completable.complete()
        .doOnSubscribe(this)
        .cache();

        assertEquals(0, count);


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 49

                      .doOnSubscribe(this)
        .cache();

        assertEquals(0, count);

        c.test().assertResult();

        assertEquals(1, count);


            

Reported by PMD.

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

Line: 51

              
        assertEquals(0, count);

        c.test().assertResult();

        assertEquals(1, count);

        c.test().assertResult();


            

Reported by PMD.

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

Line: 51

              
        assertEquals(0, count);

        c.test().assertResult();

        assertEquals(1, count);

        c.test().assertResult();


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 53

              
        c.test().assertResult();

        assertEquals(1, count);

        c.test().assertResult();

        assertEquals(1, count);


            

Reported by PMD.

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

Line: 55

              
        assertEquals(1, count);

        c.test().assertResult();

        assertEquals(1, count);

        c.test().assertResult();


            

Reported by PMD.

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

Line: 55

              
        assertEquals(1, count);

        c.test().assertResult();

        assertEquals(1, count);

        c.test().assertResult();


            

Reported by PMD.

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

Line: 37

                      @Override
        public boolean test(Integer v) {
            if (v == 42) {
                throw new RuntimeException("that's not the answer to everything!");
            }
            return v < 5;
        }
    };


            

Reported by PMD.

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

Line: 31

              
public class ObservableSkipWhileTest extends RxJavaTest {

    Observer<Integer> w = TestHelper.mockObserver();

    private static final Predicate<Integer> LESS_THAN_FIVE = new Predicate<Integer>() {
        @Override
        public boolean test(Integer v) {
            if (v == 42) {

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 36

                  private static final Predicate<Integer> LESS_THAN_FIVE = new Predicate<Integer>() {
        @Override
        public boolean test(Integer v) {
            if (v == 42) {
                throw new RuntimeException("that's not the answer to everything!");
            }
            return v < 5;
        }
    };

            

Reported by PMD.

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

Line: 52

                  };

    @Test
    public void skipWithIndex() {
        Observable<Integer> src = Observable.just(1, 2, 3, 4, 5);
        src.skipWhile(INDEX_LESS_THAN_THREE).subscribe(w);

        InOrder inOrder = inOrder(w);
        inOrder.verify(w, times(1)).onNext(4);

            

Reported by PMD.

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

Line: 54

                  @Test
    public void skipWithIndex() {
        Observable<Integer> src = Observable.just(1, 2, 3, 4, 5);
        src.skipWhile(INDEX_LESS_THAN_THREE).subscribe(w);

        InOrder inOrder = inOrder(w);
        inOrder.verify(w, times(1)).onNext(4);
        inOrder.verify(w, times(1)).onNext(5);
        inOrder.verify(w, times(1)).onComplete();

            

Reported by PMD.

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

Line: 54

                  @Test
    public void skipWithIndex() {
        Observable<Integer> src = Observable.just(1, 2, 3, 4, 5);
        src.skipWhile(INDEX_LESS_THAN_THREE).subscribe(w);

        InOrder inOrder = inOrder(w);
        inOrder.verify(w, times(1)).onNext(4);
        inOrder.verify(w, times(1)).onNext(5);
        inOrder.verify(w, times(1)).onComplete();

            

Reported by PMD.

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

Line: 57

                      src.skipWhile(INDEX_LESS_THAN_THREE).subscribe(w);

        InOrder inOrder = inOrder(w);
        inOrder.verify(w, times(1)).onNext(4);
        inOrder.verify(w, times(1)).onNext(5);
        inOrder.verify(w, times(1)).onComplete();
        inOrder.verify(w, never()).onError(any(Throwable.class));
    }


            

Reported by PMD.

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

Line: 57

                      src.skipWhile(INDEX_LESS_THAN_THREE).subscribe(w);

        InOrder inOrder = inOrder(w);
        inOrder.verify(w, times(1)).onNext(4);
        inOrder.verify(w, times(1)).onNext(5);
        inOrder.verify(w, times(1)).onComplete();
        inOrder.verify(w, never()).onError(any(Throwable.class));
    }


            

Reported by PMD.

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

Line: 58

              
        InOrder inOrder = inOrder(w);
        inOrder.verify(w, times(1)).onNext(4);
        inOrder.verify(w, times(1)).onNext(5);
        inOrder.verify(w, times(1)).onComplete();
        inOrder.verify(w, never()).onError(any(Throwable.class));
    }

    @Test

            

Reported by PMD.

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

Line: 58

              
        InOrder inOrder = inOrder(w);
        inOrder.verify(w, times(1)).onNext(4);
        inOrder.verify(w, times(1)).onNext(5);
        inOrder.verify(w, times(1)).onComplete();
        inOrder.verify(w, never()).onError(any(Throwable.class));
    }

    @Test

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableBlockingTest.java
76 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.flowable;

import static org.junit.Assert.assertEquals;

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

            

Reported by PMD.

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 FlowableBlockingTest extends RxJavaTest {

    @Test
    public void blockingFirst() {
        assertEquals(1, Flowable.range(1, 10)
                .subscribeOn(Schedulers.computation()).blockingFirst().intValue());

            

Reported by PMD.

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

Line: 40

              
    @Test
    public void blockingFirst() {
        assertEquals(1, Flowable.range(1, 10)
                .subscribeOn(Schedulers.computation()).blockingFirst().intValue());
    }

    @Test
    public void blockingFirstDefault() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 40

              
    @Test
    public void blockingFirst() {
        assertEquals(1, Flowable.range(1, 10)
                .subscribeOn(Schedulers.computation()).blockingFirst().intValue());
    }

    @Test
    public void blockingFirstDefault() {

            

Reported by PMD.

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

Line: 40

              
    @Test
    public void blockingFirst() {
        assertEquals(1, Flowable.range(1, 10)
                .subscribeOn(Schedulers.computation()).blockingFirst().intValue());
    }

    @Test
    public void blockingFirstDefault() {

            

Reported by PMD.

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

Line: 40

              
    @Test
    public void blockingFirst() {
        assertEquals(1, Flowable.range(1, 10)
                .subscribeOn(Schedulers.computation()).blockingFirst().intValue());
    }

    @Test
    public void blockingFirstDefault() {

            

Reported by PMD.

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

Line: 46

              
    @Test
    public void blockingFirstDefault() {
        assertEquals(1, Flowable.<Integer>empty()
                .subscribeOn(Schedulers.computation()).blockingFirst(1).intValue());
    }

    @Test
    public void blockingSubscribeConsumer() {

            

Reported by PMD.

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

Line: 46

              
    @Test
    public void blockingFirstDefault() {
        assertEquals(1, Flowable.<Integer>empty()
                .subscribeOn(Schedulers.computation()).blockingFirst(1).intValue());
    }

    @Test
    public void blockingSubscribeConsumer() {

            

Reported by PMD.

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

Line: 46

              
    @Test
    public void blockingFirstDefault() {
        assertEquals(1, Flowable.<Integer>empty()
                .subscribeOn(Schedulers.computation()).blockingFirst(1).intValue());
    }

    @Test
    public void blockingSubscribeConsumer() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 46

              
    @Test
    public void blockingFirstDefault() {
        assertEquals(1, Flowable.<Integer>empty()
                .subscribeOn(Schedulers.computation()).blockingFirst(1).intValue());
    }

    @Test
    public void blockingSubscribeConsumer() {

            

Reported by PMD.