The following issues were found

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

Line: 28

              public class MaybeOfTypeTest extends RxJavaTest {

    @Test
    public void normal() {
        Maybe.just(1).ofType(Integer.class)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 29

              
    @Test
    public void normal() {
        Maybe.just(1).ofType(Integer.class)
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 29

              
    @Test
    public void normal() {
        Maybe.just(1).ofType(Integer.class)
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 29

              
    @Test
    public void normal() {
        Maybe.just(1).ofType(Integer.class)
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 35

                  }

    @Test
    public void normalDowncast() {
        TestObserver<Number> to = Maybe.just(1)
        .ofType(Number.class)
        .test();
        // don't make this fluent, target type required!
        to.assertResult((Number)1);

            

Reported by PMD.

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

Line: 36

              
    @Test
    public void normalDowncast() {
        TestObserver<Number> to = Maybe.just(1)
        .ofType(Number.class)
        .test();
        // don't make this fluent, target type required!
        to.assertResult((Number)1);
    }

            

Reported by PMD.

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

Line: 36

              
    @Test
    public void normalDowncast() {
        TestObserver<Number> to = Maybe.just(1)
        .ofType(Number.class)
        .test();
        // don't make this fluent, target type required!
        to.assertResult((Number)1);
    }

            

Reported by PMD.

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

Line: 40

                      .ofType(Number.class)
        .test();
        // don't make this fluent, target type required!
        to.assertResult((Number)1);
    }

    @Test
    public void notInstance() {
        TestObserver<String> to = Maybe.just(1)

            

Reported by PMD.

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

Line: 44

                  }

    @Test
    public void notInstance() {
        TestObserver<String> to = Maybe.just(1)
        .ofType(String.class)
        .test();
        // don't make this fluent, target type required!
        to.assertResult();

            

Reported by PMD.

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

Line: 45

              
    @Test
    public void notInstance() {
        TestObserver<String> to = Maybe.just(1)
        .ofType(String.class)
        .test();
        // don't make this fluent, target type required!
        to.assertResult();
    }

            

Reported by PMD.

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

Line: 28

              public class SingleOfTypeTest extends RxJavaTest {

    @Test
    public void normal() {
        Single.just(1).ofType(Integer.class)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 29

              
    @Test
    public void normal() {
        Single.just(1).ofType(Integer.class)
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 29

              
    @Test
    public void normal() {
        Single.just(1).ofType(Integer.class)
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 29

              
    @Test
    public void normal() {
        Single.just(1).ofType(Integer.class)
        .test()
        .assertResult(1);
    }

    @Test

            

Reported by PMD.

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

Line: 35

                  }

    @Test
    public void normalDowncast() {
        TestObserver<Number> to = Single.just(1)
        .ofType(Number.class)
        .test();
        // don't make this fluent, target type required!
        to.assertResult((Number)1);

            

Reported by PMD.

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

Line: 36

              
    @Test
    public void normalDowncast() {
        TestObserver<Number> to = Single.just(1)
        .ofType(Number.class)
        .test();
        // don't make this fluent, target type required!
        to.assertResult((Number)1);
    }

            

Reported by PMD.

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

Line: 36

              
    @Test
    public void normalDowncast() {
        TestObserver<Number> to = Single.just(1)
        .ofType(Number.class)
        .test();
        // don't make this fluent, target type required!
        to.assertResult((Number)1);
    }

            

Reported by PMD.

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

Line: 40

                      .ofType(Number.class)
        .test();
        // don't make this fluent, target type required!
        to.assertResult((Number)1);
    }

    @Test
    public void notInstance() {
        TestObserver<String> to = Single.just(1)

            

Reported by PMD.

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

Line: 44

                  }

    @Test
    public void notInstance() {
        TestObserver<String> to = Single.just(1)
        .ofType(String.class)
        .test();
        // don't make this fluent, target type required!
        to.assertResult();

            

Reported by PMD.

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

Line: 45

              
    @Test
    public void notInstance() {
        TestObserver<String> to = Single.just(1)
        .ofType(String.class)
        .test();
        // don't make this fluent, target type required!
        to.assertResult();
    }

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDeferTest.java
20 issues
Potential violation of Law of Demeter (method chain calls)
Design

Line: 37

              
        Flowable<String> firstObservable = Flowable.just("one", "two");
        Flowable<String> secondObservable = Flowable.just("three", "four");
        when(factory.get()).thenReturn(firstObservable, secondObservable);

        Flowable<String> deferred = Flowable.defer(factory);

        verifyNoInteractions(factory);


            

Reported by PMD.

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

Line: 37

              
        Flowable<String> firstObservable = Flowable.just("one", "two");
        Flowable<String> secondObservable = Flowable.just("three", "four");
        when(factory.get()).thenReturn(firstObservable, secondObservable);

        Flowable<String> deferred = Flowable.defer(factory);

        verifyNoInteractions(factory);


            

Reported by PMD.

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

Line: 46

                      Subscriber<String> firstSubscriber = TestHelper.mockSubscriber();
        deferred.subscribe(firstSubscriber);

        verify(factory, times(1)).get();
        verify(firstSubscriber, times(1)).onNext("one");
        verify(firstSubscriber, times(1)).onNext("two");
        verify(firstSubscriber, times(0)).onNext("three");
        verify(firstSubscriber, times(0)).onNext("four");
        verify(firstSubscriber, times(1)).onComplete();

            

Reported by PMD.

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

Line: 47

                      deferred.subscribe(firstSubscriber);

        verify(factory, times(1)).get();
        verify(firstSubscriber, times(1)).onNext("one");
        verify(firstSubscriber, times(1)).onNext("two");
        verify(firstSubscriber, times(0)).onNext("three");
        verify(firstSubscriber, times(0)).onNext("four");
        verify(firstSubscriber, times(1)).onComplete();


            

Reported by PMD.

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

Line: 48

              
        verify(factory, times(1)).get();
        verify(firstSubscriber, times(1)).onNext("one");
        verify(firstSubscriber, times(1)).onNext("two");
        verify(firstSubscriber, times(0)).onNext("three");
        verify(firstSubscriber, times(0)).onNext("four");
        verify(firstSubscriber, times(1)).onComplete();

        Subscriber<String> secondSubscriber = TestHelper.mockSubscriber();

            

Reported by PMD.

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

Line: 49

                      verify(factory, times(1)).get();
        verify(firstSubscriber, times(1)).onNext("one");
        verify(firstSubscriber, times(1)).onNext("two");
        verify(firstSubscriber, times(0)).onNext("three");
        verify(firstSubscriber, times(0)).onNext("four");
        verify(firstSubscriber, times(1)).onComplete();

        Subscriber<String> secondSubscriber = TestHelper.mockSubscriber();
        deferred.subscribe(secondSubscriber);

            

Reported by PMD.

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

Line: 50

                      verify(firstSubscriber, times(1)).onNext("one");
        verify(firstSubscriber, times(1)).onNext("two");
        verify(firstSubscriber, times(0)).onNext("three");
        verify(firstSubscriber, times(0)).onNext("four");
        verify(firstSubscriber, times(1)).onComplete();

        Subscriber<String> secondSubscriber = TestHelper.mockSubscriber();
        deferred.subscribe(secondSubscriber);


            

Reported by PMD.

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

Line: 51

                      verify(firstSubscriber, times(1)).onNext("two");
        verify(firstSubscriber, times(0)).onNext("three");
        verify(firstSubscriber, times(0)).onNext("four");
        verify(firstSubscriber, times(1)).onComplete();

        Subscriber<String> secondSubscriber = TestHelper.mockSubscriber();
        deferred.subscribe(secondSubscriber);

        verify(factory, times(2)).get();

            

Reported by PMD.

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

Line: 56

                      Subscriber<String> secondSubscriber = TestHelper.mockSubscriber();
        deferred.subscribe(secondSubscriber);

        verify(factory, times(2)).get();
        verify(secondSubscriber, times(0)).onNext("one");
        verify(secondSubscriber, times(0)).onNext("two");
        verify(secondSubscriber, times(1)).onNext("three");
        verify(secondSubscriber, times(1)).onNext("four");
        verify(secondSubscriber, times(1)).onComplete();

            

Reported by PMD.

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

Line: 57

                      deferred.subscribe(secondSubscriber);

        verify(factory, times(2)).get();
        verify(secondSubscriber, times(0)).onNext("one");
        verify(secondSubscriber, times(0)).onNext("two");
        verify(secondSubscriber, times(1)).onNext("three");
        verify(secondSubscriber, times(1)).onNext("four");
        verify(secondSubscriber, times(1)).onComplete();


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDeferTest.java
20 issues
Potential violation of Law of Demeter (method chain calls)
Design

Line: 36

              
        Observable<String> firstObservable = Observable.just("one", "two");
        Observable<String> secondObservable = Observable.just("three", "four");
        when(factory.get()).thenReturn(firstObservable, secondObservable);

        Observable<String> deferred = Observable.defer(factory);

        verifyNoInteractions(factory);


            

Reported by PMD.

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

Line: 36

              
        Observable<String> firstObservable = Observable.just("one", "two");
        Observable<String> secondObservable = Observable.just("three", "four");
        when(factory.get()).thenReturn(firstObservable, secondObservable);

        Observable<String> deferred = Observable.defer(factory);

        verifyNoInteractions(factory);


            

Reported by PMD.

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

Line: 45

                      Observer<String> firstObserver = TestHelper.mockObserver();
        deferred.subscribe(firstObserver);

        verify(factory, times(1)).get();
        verify(firstObserver, times(1)).onNext("one");
        verify(firstObserver, times(1)).onNext("two");
        verify(firstObserver, times(0)).onNext("three");
        verify(firstObserver, times(0)).onNext("four");
        verify(firstObserver, times(1)).onComplete();

            

Reported by PMD.

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

Line: 46

                      deferred.subscribe(firstObserver);

        verify(factory, times(1)).get();
        verify(firstObserver, times(1)).onNext("one");
        verify(firstObserver, times(1)).onNext("two");
        verify(firstObserver, times(0)).onNext("three");
        verify(firstObserver, times(0)).onNext("four");
        verify(firstObserver, times(1)).onComplete();


            

Reported by PMD.

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

Line: 47

              
        verify(factory, times(1)).get();
        verify(firstObserver, times(1)).onNext("one");
        verify(firstObserver, times(1)).onNext("two");
        verify(firstObserver, times(0)).onNext("three");
        verify(firstObserver, times(0)).onNext("four");
        verify(firstObserver, times(1)).onComplete();

        Observer<String> secondObserver = TestHelper.mockObserver();

            

Reported by PMD.

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

Line: 48

                      verify(factory, times(1)).get();
        verify(firstObserver, times(1)).onNext("one");
        verify(firstObserver, times(1)).onNext("two");
        verify(firstObserver, times(0)).onNext("three");
        verify(firstObserver, times(0)).onNext("four");
        verify(firstObserver, times(1)).onComplete();

        Observer<String> secondObserver = TestHelper.mockObserver();
        deferred.subscribe(secondObserver);

            

Reported by PMD.

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

Line: 49

                      verify(firstObserver, times(1)).onNext("one");
        verify(firstObserver, times(1)).onNext("two");
        verify(firstObserver, times(0)).onNext("three");
        verify(firstObserver, times(0)).onNext("four");
        verify(firstObserver, times(1)).onComplete();

        Observer<String> secondObserver = TestHelper.mockObserver();
        deferred.subscribe(secondObserver);


            

Reported by PMD.

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

Line: 50

                      verify(firstObserver, times(1)).onNext("two");
        verify(firstObserver, times(0)).onNext("three");
        verify(firstObserver, times(0)).onNext("four");
        verify(firstObserver, times(1)).onComplete();

        Observer<String> secondObserver = TestHelper.mockObserver();
        deferred.subscribe(secondObserver);

        verify(factory, times(2)).get();

            

Reported by PMD.

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

Line: 55

                      Observer<String> secondObserver = TestHelper.mockObserver();
        deferred.subscribe(secondObserver);

        verify(factory, times(2)).get();
        verify(secondObserver, times(0)).onNext("one");
        verify(secondObserver, times(0)).onNext("two");
        verify(secondObserver, times(1)).onNext("three");
        verify(secondObserver, times(1)).onNext("four");
        verify(secondObserver, times(1)).onComplete();

            

Reported by PMD.

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

Line: 56

                      deferred.subscribe(secondObserver);

        verify(factory, times(2)).get();
        verify(secondObserver, times(0)).onNext("one");
        verify(secondObserver, times(0)).onNext("two");
        verify(secondObserver, times(1)).onNext("three");
        verify(secondObserver, times(1)).onNext("four");
        verify(secondObserver, times(1)).onComplete();


            

Reported by PMD.

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

Line: 32

              public class CompletableOnErrorXTest extends RxJavaTest {

    @Test
    public void normalReturn() {
        Completable.complete()
        .onErrorComplete()
        .test()
        .assertResult();
    }

            

Reported by PMD.

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

Line: 33

              
    @Test
    public void normalReturn() {
        Completable.complete()
        .onErrorComplete()
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 33

              
    @Test
    public void normalReturn() {
        Completable.complete()
        .onErrorComplete()
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 33

              
    @Test
    public void normalReturn() {
        Completable.complete()
        .onErrorComplete()
        .test()
        .assertResult();
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 53

                      .test()
        .assertResult();

        assertEquals(0, call[0]);
    }

    @Test
    public void onErrorReturnConst() {
        Completable.error(new TestException())

            

Reported by PMD.

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

Line: 57

                  }

    @Test
    public void onErrorReturnConst() {
        Completable.error(new TestException())
        .onErrorReturnItem(1)
        .test()
        .assertResult(1);
    }

            

Reported by PMD.

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

Line: 65

                  }

    @Test
    public void onErrorReturn() {
        Completable.error(new TestException())
        .onErrorReturn(Functions.justFunction(1))
        .test()
        .assertResult(1);
    }

            

Reported by PMD.

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

Line: 73

                  }

    @Test
    public void onErrorReturnFunctionThrows() {
        TestHelper.assertCompositeExceptions(Completable.error(new TestException())
        .onErrorReturn(new Function<Throwable, Object>() {
            @Override
            public Object apply(Throwable v) throws Exception {
                throw new IOException();

            

Reported by PMD.

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

Line: 85

                  }

    @Test
    public void onErrorReturnEmpty() {
        Completable.complete()
        .onErrorReturnItem(2)
        .test()
        .assertResult();
    }

            

Reported by PMD.

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

Line: 86

              
    @Test
    public void onErrorReturnEmpty() {
        Completable.complete()
        .onErrorReturnItem(2)
        .test()
        .assertResult();
    }


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableGenerateTest.java
20 issues
JUnit tests should include assert() or fail()
Design

Line: 32

              public class ObservableGenerateTest extends RxJavaTest {

    @Test
    public void statefulBiconsumer() {
        Observable.generate(new Supplier<Object>() {
            @Override
            public Object get() throws Exception {
                return 10;
            }

            

Reported by PMD.

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

Line: 55

                  }

    @Test
    public void stateSupplierThrows() {
        Observable.generate(new Supplier<Object>() {
            @Override
            public Object get() throws Exception {
                throw new TestException();
            }

            

Reported by PMD.

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

Line: 72

                  }

    @Test
    public void generatorThrows() {
        Observable.generate(new Supplier<Object>() {
            @Override
            public Object get() throws Exception {
                return 1;
            }

            

Reported by PMD.

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

Line: 89

                  }

    @Test
    public void disposerThrows() {
        List<Throwable> errors = TestHelper.trackPluginErrors();
        try {
            Observable.generate(new Supplier<Object>() {
                @Override
                public Object get() throws Exception {

            

Reported by PMD.

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

Line: 118

                  }

    @Test
    public void dispose() {
        TestHelper.checkDisposed(Observable.generate(new Supplier<Object>() {
                @Override
                public Object get() throws Exception {
                    return 1;
                }

            

Reported by PMD.

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

Line: 141

                          public void accept(Integer s, Emitter<Object> e) throws Exception {
                try {
                    e.onError(null);
                } catch (NullPointerException ex) {
                    call[0]++;
                }
            }
        }, Functions.emptyConsumer())
        .test()

            

Reported by PMD.

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

Line: 141

                          public void accept(Integer s, Emitter<Object> e) throws Exception {
                try {
                    e.onError(null);
                } catch (NullPointerException ex) {
                    call[0]++;
                }
            }
        }, Functions.emptyConsumer())
        .test()

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 149

                      .test()
        .assertFailure(NullPointerException.class);

        assertEquals(0, call[0]);
    }

    @Test
    public void multipleOnNext() {
        Observable.generate(new Consumer<Emitter<Object>>() {

            

Reported by PMD.

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

Line: 153

                  }

    @Test
    public void multipleOnNext() {
        Observable.generate(new Consumer<Emitter<Object>>() {
            @Override
            public void accept(Emitter<Object> e) throws Exception {
                e.onNext(1);
                e.onNext(2);

            

Reported by PMD.

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

Line: 166

                  }

    @Test
    public void multipleOnError() {
        List<Throwable> errors = TestHelper.trackPluginErrors();
        try {
            Observable.generate(new Consumer<Emitter<Object>>() {
                @Override
                public void accept(Emitter<Object> e) throws Exception {

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/flowable/FlowableDoOnTest.java
20 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 29

              public class FlowableDoOnTest extends RxJavaTest {

    @Test
    public void doOnEach() {
        final AtomicReference<String> r = new AtomicReference<>();
        String output = Flowable.just("one").doOnNext(new Consumer<String>() {
            @Override
            public void accept(String v) {
                r.set(v);

            

Reported by PMD.

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

Line: 31

                  @Test
    public void doOnEach() {
        final AtomicReference<String> r = new AtomicReference<>();
        String output = Flowable.just("one").doOnNext(new Consumer<String>() {
            @Override
            public void accept(String v) {
                r.set(v);
            }
        }).blockingSingle();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 38

                          }
        }).blockingSingle();

        assertEquals("one", output);
        assertEquals("one", r.get());
    }

    @Test
    public void doOnError() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 39

                      }).blockingSingle();

        assertEquals("one", output);
        assertEquals("one", r.get());
    }

    @Test
    public void doOnError() {
        final AtomicReference<Throwable> r = new AtomicReference<>();

            

Reported by PMD.

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

Line: 43

                  }

    @Test
    public void doOnError() {
        final AtomicReference<Throwable> r = new AtomicReference<>();
        Throwable t = null;
        try {
            Flowable.<String> error(new RuntimeException("an error"))
            .doOnError(new Consumer<Throwable>() {

            

Reported by PMD.

A catch statement should never catch throwable since it includes errors.
Error

Line: 55

                              }
            }).blockingSingle();
            fail("expected exception, not a return value");
        } catch (Throwable e) {
            t = e;
        }

        assertNotNull(t);
        assertEquals(t, r.get());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 59

                          t = e;
        }

        assertNotNull(t);
        assertEquals(t, r.get());
    }

    @Test
    public void doOnCompleted() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 60

                      }

        assertNotNull(t);
        assertEquals(t, r.get());
    }

    @Test
    public void doOnCompleted() {
        final AtomicBoolean r = new AtomicBoolean();

            

Reported by PMD.

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

Line: 64

                  }

    @Test
    public void doOnCompleted() {
        final AtomicBoolean r = new AtomicBoolean();
        String output = Flowable.just("one").doOnComplete(new Action() {
            @Override
            public void run() {
                r.set(true);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 73

                          }
        }).blockingSingle();

        assertEquals("one", output);
        assertTrue(r.get());
    }

    @Test
    public void doOnTerminateError() {

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableConcatWithCompletableTest.java
19 issues
JUnit tests should include assert() or fail()
Design

Line: 35

              public class FlowableConcatWithCompletableTest extends RxJavaTest {

    @Test
    public void normal() {
        final TestSubscriber<Integer> ts = new TestSubscriber<>();

        Flowable.range(1, 5)
        .concatWith(Completable.fromAction(new Action() {
            @Override

            

Reported by PMD.

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

Line: 51

                  }

    @Test
    public void mainError() {
        final TestSubscriber<Integer> ts = new TestSubscriber<>();

        Flowable.<Integer>error(new TestException())
        .concatWith(Completable.fromAction(new Action() {
            @Override

            

Reported by PMD.

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

Line: 67

                  }

    @Test
    public void otherError() {
        final TestSubscriber<Integer> ts = new TestSubscriber<>();

        Flowable.range(1, 5)
        .concatWith(Completable.error(new TestException()))
        .subscribe(ts);

            

Reported by PMD.

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

Line: 78

                  }

    @Test
    public void takeMain() {
        final TestSubscriber<Integer> ts = new TestSubscriber<>();

        Flowable.range(1, 5)
        .concatWith(Completable.fromAction(new Action() {
            @Override

            

Reported by PMD.

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

Line: 95

                  }

    @Test
    public void cancelOther() {
        CompletableSubject other = CompletableSubject.create();

        TestSubscriber<Object> ts = Flowable.empty()
                .concatWith(other)
                .test();

            

Reported by PMD.

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

Line: 98

                  public void cancelOther() {
        CompletableSubject other = CompletableSubject.create();

        TestSubscriber<Object> ts = Flowable.empty()
                .concatWith(other)
                .test();

        assertTrue(other.hasObservers());


            

Reported by PMD.

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

Line: 98

                  public void cancelOther() {
        CompletableSubject other = CompletableSubject.create();

        TestSubscriber<Object> ts = Flowable.empty()
                .concatWith(other)
                .test();

        assertTrue(other.hasObservers());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 102

                              .concatWith(other)
                .test();

        assertTrue(other.hasObservers());

        ts.cancel();

        assertFalse(other.hasObservers());
    }

            

Reported by PMD.

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

Line: 102

                              .concatWith(other)
                .test();

        assertTrue(other.hasObservers());

        ts.cancel();

        assertFalse(other.hasObservers());
    }

            

Reported by PMD.

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

Line: 104

              
        assertTrue(other.hasObservers());

        ts.cancel();

        assertFalse(other.hasObservers());
    }

    @Test

            

Reported by PMD.

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

Line: 33

                  public void hiding() {
        PublishSubject<Integer> src = PublishSubject.create();

        Observable<Integer> dst = src.hide();

        assertFalse(dst instanceof PublishSubject);

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


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 35

              
        Observable<Integer> dst = src.hide();

        assertFalse(dst instanceof PublishSubject);

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

        dst.subscribe(o);


            

Reported by PMD.

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

Line: 39

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

        dst.subscribe(o);

        src.onNext(1);
        src.onComplete();

        verify(o).onNext(1);

            

Reported by PMD.

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

Line: 41

              
        dst.subscribe(o);

        src.onNext(1);
        src.onComplete();

        verify(o).onNext(1);
        verify(o).onComplete();
        verify(o, never()).onError(any(Throwable.class));

            

Reported by PMD.

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

Line: 42

                      dst.subscribe(o);

        src.onNext(1);
        src.onComplete();

        verify(o).onNext(1);
        verify(o).onComplete();
        verify(o, never()).onError(any(Throwable.class));
    }

            

Reported by PMD.

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

Line: 44

                      src.onNext(1);
        src.onComplete();

        verify(o).onNext(1);
        verify(o).onComplete();
        verify(o, never()).onError(any(Throwable.class));
    }

    @Test

            

Reported by PMD.

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

Line: 45

                      src.onComplete();

        verify(o).onNext(1);
        verify(o).onComplete();
        verify(o, never()).onError(any(Throwable.class));
    }

    @Test
    public void hidingError() {

            

Reported by PMD.

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

Line: 46

              
        verify(o).onNext(1);
        verify(o).onComplete();
        verify(o, never()).onError(any(Throwable.class));
    }

    @Test
    public void hidingError() {
        PublishSubject<Integer> src = PublishSubject.create();

            

Reported by PMD.

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

Line: 53

                  public void hidingError() {
        PublishSubject<Integer> src = PublishSubject.create();

        Observable<Integer> dst = src.hide();

        assertFalse(dst instanceof PublishSubject);

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


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 55

              
        Observable<Integer> dst = src.hide();

        assertFalse(dst instanceof PublishSubject);

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

        dst.subscribe(o);


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/flowable/FlowableCombineLatestTests.java
19 issues
System.out.println is used
Design

Line: 50

                  Consumer<Result> action = new Consumer<Result>() {
        @Override
        public void accept(Result t1) {
            System.out.println("Result: " + t1);
        }
    };

    Consumer<ExtendedResult> extendedAction = new Consumer<ExtendedResult>() {
        @Override

            

Reported by PMD.

System.out.println is used
Design

Line: 57

                  Consumer<ExtendedResult> extendedAction = new Consumer<ExtendedResult>() {
        @Override
        public void accept(ExtendedResult t1) {
            System.out.println("Result: " + t1);
        }
    };
}

            

Reported by PMD.

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

Line: 27

                   * This won't compile if super/extends isn't done correctly on generics.
     */
    @Test
    public void covarianceOfCombineLatest() {
        Flowable<HorrorMovie> horrors = Flowable.just(new HorrorMovie());
        Flowable<CoolRating> ratings = Flowable.just(new CoolRating());

        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);

            

Reported by PMD.

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

Line: 31

                      Flowable<HorrorMovie> horrors = Flowable.just(new HorrorMovie());
        Flowable<CoolRating> ratings = Flowable.just(new CoolRating());

        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(extendedAction);
        Flowable.<Media, Rating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(action);


            

Reported by PMD.

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

Line: 31

                      Flowable<HorrorMovie> horrors = Flowable.just(new HorrorMovie());
        Flowable<CoolRating> ratings = Flowable.just(new CoolRating());

        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(extendedAction);
        Flowable.<Media, Rating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(action);


            

Reported by PMD.

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

Line: 32

                      Flowable<CoolRating> ratings = Flowable.just(new CoolRating());

        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(extendedAction);
        Flowable.<Media, Rating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(action);

        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine);

            

Reported by PMD.

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

Line: 32

                      Flowable<CoolRating> ratings = Flowable.just(new CoolRating());

        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(extendedAction);
        Flowable.<Media, Rating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(action);

        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine);

            

Reported by PMD.

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

Line: 33

              
        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(extendedAction);
        Flowable.<Media, Rating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(action);

        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine);
    }

            

Reported by PMD.

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

Line: 33

              
        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(extendedAction);
        Flowable.<Media, Rating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(action);

        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine);
    }

            

Reported by PMD.

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

Line: 34

                      Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(extendedAction);
        Flowable.<Media, Rating, Result> combineLatest(horrors, ratings, combine).blockingForEach(action);
        Flowable.<Media, Rating, ExtendedResult> combineLatest(horrors, ratings, combine).blockingForEach(action);

        Flowable.<Movie, CoolRating, Result> combineLatest(horrors, ratings, combine);
    }


            

Reported by PMD.