The following issues were found

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

Line: 30

              public class CompletableHideTest extends RxJavaTest {

    @Test
    public void never() {
        Completable.never()
        .hide()
        .test()
        .assertNotComplete()
        .assertNoErrors();

            

Reported by PMD.

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

Line: 31

              
    @Test
    public void never() {
        Completable.never()
        .hide()
        .test()
        .assertNotComplete()
        .assertNoErrors();
    }

            

Reported by PMD.

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

Line: 31

              
    @Test
    public void never() {
        Completable.never()
        .hide()
        .test()
        .assertNotComplete()
        .assertNoErrors();
    }

            

Reported by PMD.

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

Line: 31

              
    @Test
    public void never() {
        Completable.never()
        .hide()
        .test()
        .assertNotComplete()
        .assertNoErrors();
    }

            

Reported by PMD.

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

Line: 31

              
    @Test
    public void never() {
        Completable.never()
        .hide()
        .test()
        .assertNotComplete()
        .assertNoErrors();
    }

            

Reported by PMD.

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

Line: 39

                  }

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

            

Reported by PMD.

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

Line: 40

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


            

Reported by PMD.

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

Line: 40

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


            

Reported by PMD.

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

Line: 40

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


            

Reported by PMD.

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

Line: 47

                  }

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

            

Reported by PMD.

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

Line: 32

              public class SingleFlatMapNotificationTest extends RxJavaTest {

    @Test
    public void dispose() {
        TestHelper.checkDisposed(Single.just(1)
                .flatMap(Functions.justFunction(Single.just(1)),
                        Functions.justFunction(Single.just(1))));
    }


            

Reported by PMD.

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

Line: 33

              
    @Test
    public void dispose() {
        TestHelper.checkDisposed(Single.just(1)
                .flatMap(Functions.justFunction(Single.just(1)),
                        Functions.justFunction(Single.just(1))));
    }

    @Test

            

Reported by PMD.

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

Line: 39

                  }

    @Test
    public void doubleOnSubscribe() {
        TestHelper.checkDoubleOnSubscribeSingle(new Function<Single<Integer>, SingleSource<Integer>>() {
            @Override
            public SingleSource<Integer> apply(Single<Integer> m) throws Exception {
                return m
                        .flatMap(Functions.justFunction(Single.just(1)),

            

Reported by PMD.

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

Line: 51

                  }

    @Test
    public void onSuccessNull() {
        Single.just(1)
        .flatMap(Functions.justFunction((Single<Integer>)null),
                Functions.justFunction(Single.just(1)))
        .test()
        .assertFailure(NullPointerException.class);

            

Reported by PMD.

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

Line: 60

                  }

    @Test
    public void onErrorNull() {
        TestObserverEx<Integer> to = Single.<Integer>error(new TestException())
        .flatMap(Functions.justFunction(Single.just(1)),
                Functions.justFunction((Single<Integer>)null))
        .to(TestHelper.<Integer>testConsumer())
        .assertFailure(CompositeException.class);

            

Reported by PMD.

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

Line: 67

                      .to(TestHelper.<Integer>testConsumer())
        .assertFailure(CompositeException.class);

        List<Throwable> ce = TestHelper.compositeList(to.errors().get(0));

        TestHelper.assertError(ce, 0, TestException.class);
        TestHelper.assertError(ce, 1, NullPointerException.class);
    }


            

Reported by PMD.

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

Line: 74

                  }

    @Test
    public void onSuccessError() {
        Single.just(1)
        .flatMap(Functions.justFunction(Single.<Integer>error(new TestException())),
                Functions.justFunction((Single<Integer>)null))
        .test()
        .assertFailure(TestException.class);

            

Reported by PMD.

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

Line: 83

                  }

    @Test
    public void onSucccessSuccess() {
        Single.just(1)
        .flatMap(v -> Single.just(2), e -> Single.just(3))
        .test()
        .assertResult(2);
    }

            

Reported by PMD.

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

Line: 84

              
    @Test
    public void onSucccessSuccess() {
        Single.just(1)
        .flatMap(v -> Single.just(2), e -> Single.just(3))
        .test()
        .assertResult(2);
    }


            

Reported by PMD.

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

Line: 84

              
    @Test
    public void onSucccessSuccess() {
        Single.just(1)
        .flatMap(v -> Single.just(2), e -> Single.just(3))
        .test()
        .assertResult(2);
    }


            

Reported by PMD.

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

Line: 32

                  @Test
    public void cast() {
        Flowable<?> source = Flowable.just(1, 2);
        Flowable<Integer> flowable = source.cast(Integer.class);

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

        flowable.subscribe(subscriber);


            

Reported by PMD.

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

Line: 36

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

        flowable.subscribe(subscriber);

        verify(subscriber, times(1)).onNext(1);
        verify(subscriber, times(1)).onNext(1);
        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: 38

              
        flowable.subscribe(subscriber);

        verify(subscriber, times(1)).onNext(1);
        verify(subscriber, times(1)).onNext(1);
        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: 39

                      flowable.subscribe(subscriber);

        verify(subscriber, times(1)).onNext(1);
        verify(subscriber, times(1)).onNext(1);
        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: 40

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

    @Test
    public void castWithWrongType() {

            

Reported by PMD.

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

Line: 41

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

    @Test
    public void castWithWrongType() {
        Flowable<?> source = Flowable.just(1, 2);

            

Reported by PMD.

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

Line: 47

                  @Test
    public void castWithWrongType() {
        Flowable<?> source = Flowable.just(1, 2);
        Flowable<Boolean> flowable = source.cast(Boolean.class);

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

        flowable.subscribe(subscriber);


            

Reported by PMD.

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

Line: 51

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

        flowable.subscribe(subscriber);

        verify(subscriber, times(1)).onError(any(ClassCastException.class));
    }

    @Test

            

Reported by PMD.

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

Line: 53

              
        flowable.subscribe(subscriber);

        verify(subscriber, times(1)).onError(any(ClassCastException.class));
    }

    @Test
    public void castCrashUnsubscribes() {


            

Reported by PMD.

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

Line: 63

              
        TestSubscriber<String> ts = TestSubscriber.create();

        pp.cast(String.class).subscribe(ts);

        Assert.assertTrue("Not subscribed?", pp.hasSubscribers());

        pp.onNext(1);


            

Reported by PMD.

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

Line: 26

              public class SingleFromTest extends RxJavaTest {

    @Test
    public void fromFuture() throws Exception {
        Single.fromFuture(Flowable.just(1).toFuture())
        .subscribeOn(Schedulers.io())
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult(1);

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 26

              public class SingleFromTest extends RxJavaTest {

    @Test
    public void fromFuture() throws Exception {
        Single.fromFuture(Flowable.just(1).toFuture())
        .subscribeOn(Schedulers.io())
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult(1);

            

Reported by PMD.

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

Line: 27

              
    @Test
    public void fromFuture() throws Exception {
        Single.fromFuture(Flowable.just(1).toFuture())
        .subscribeOn(Schedulers.io())
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult(1);
    }

            

Reported by PMD.

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

Line: 27

              
    @Test
    public void fromFuture() throws Exception {
        Single.fromFuture(Flowable.just(1).toFuture())
        .subscribeOn(Schedulers.io())
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult(1);
    }

            

Reported by PMD.

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

Line: 27

              
    @Test
    public void fromFuture() throws Exception {
        Single.fromFuture(Flowable.just(1).toFuture())
        .subscribeOn(Schedulers.io())
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult(1);
    }

            

Reported by PMD.

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

Line: 27

              
    @Test
    public void fromFuture() throws Exception {
        Single.fromFuture(Flowable.just(1).toFuture())
        .subscribeOn(Schedulers.io())
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult(1);
    }

            

Reported by PMD.

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

Line: 27

              
    @Test
    public void fromFuture() throws Exception {
        Single.fromFuture(Flowable.just(1).toFuture())
        .subscribeOn(Schedulers.io())
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertResult(1);
    }

            

Reported by PMD.

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

Line: 35

                  }

    @Test
    public void fromFutureTimeout() throws Exception {
        Single.fromFuture(Flowable.never().toFuture(), 1, TimeUnit.SECONDS)
        .subscribeOn(Schedulers.io())
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertFailure(TimeoutException.class);

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 35

                  }

    @Test
    public void fromFutureTimeout() throws Exception {
        Single.fromFuture(Flowable.never().toFuture(), 1, TimeUnit.SECONDS)
        .subscribeOn(Schedulers.io())
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertFailure(TimeoutException.class);

            

Reported by PMD.

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

Line: 36

              
    @Test
    public void fromFutureTimeout() throws Exception {
        Single.fromFuture(Flowable.never().toFuture(), 1, TimeUnit.SECONDS)
        .subscribeOn(Schedulers.io())
        .test()
        .awaitDone(5, TimeUnit.SECONDS)
        .assertFailure(TimeoutException.class);
    }

            

Reported by PMD.

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

Line: 28

              public class SingleInternalHelperTest extends RxJavaTest {

    @Test
    public void utilityClass() {
        TestHelper.checkUtilityClass(SingleInternalHelper.class);
    }

    @Test
    public void noSuchElementCallableEnum() {

            

Reported by PMD.

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

Line: 33

                  }

    @Test
    public void noSuchElementCallableEnum() {
        assertEquals(1, SingleInternalHelper.NoSuchElementSupplier.values().length);
        assertNotNull(SingleInternalHelper.NoSuchElementSupplier.valueOf("INSTANCE"));
    }

    @Test

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 34

              
    @Test
    public void noSuchElementCallableEnum() {
        assertEquals(1, SingleInternalHelper.NoSuchElementSupplier.values().length);
        assertNotNull(SingleInternalHelper.NoSuchElementSupplier.valueOf("INSTANCE"));
    }

    @Test
    public void toFlowableEnum() {

            

Reported by PMD.

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

Line: 34

              
    @Test
    public void noSuchElementCallableEnum() {
        assertEquals(1, SingleInternalHelper.NoSuchElementSupplier.values().length);
        assertNotNull(SingleInternalHelper.NoSuchElementSupplier.valueOf("INSTANCE"));
    }

    @Test
    public void toFlowableEnum() {

            

Reported by PMD.

Potential violation of Law of Demeter (static property access)
Design

Line: 34

              
    @Test
    public void noSuchElementCallableEnum() {
        assertEquals(1, SingleInternalHelper.NoSuchElementSupplier.values().length);
        assertNotNull(SingleInternalHelper.NoSuchElementSupplier.valueOf("INSTANCE"));
    }

    @Test
    public void toFlowableEnum() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 35

                  @Test
    public void noSuchElementCallableEnum() {
        assertEquals(1, SingleInternalHelper.NoSuchElementSupplier.values().length);
        assertNotNull(SingleInternalHelper.NoSuchElementSupplier.valueOf("INSTANCE"));
    }

    @Test
    public void toFlowableEnum() {
        assertEquals(1, SingleInternalHelper.ToFlowable.values().length);

            

Reported by PMD.

Potential violation of Law of Demeter (static property access)
Design

Line: 35

                  @Test
    public void noSuchElementCallableEnum() {
        assertEquals(1, SingleInternalHelper.NoSuchElementSupplier.values().length);
        assertNotNull(SingleInternalHelper.NoSuchElementSupplier.valueOf("INSTANCE"));
    }

    @Test
    public void toFlowableEnum() {
        assertEquals(1, SingleInternalHelper.ToFlowable.values().length);

            

Reported by PMD.

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

Line: 39

                  }

    @Test
    public void toFlowableEnum() {
        assertEquals(1, SingleInternalHelper.ToFlowable.values().length);
        assertNotNull(SingleInternalHelper.ToFlowable.valueOf("INSTANCE"));
    }

    @Test

            

Reported by PMD.

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

Line: 40

              
    @Test
    public void toFlowableEnum() {
        assertEquals(1, SingleInternalHelper.ToFlowable.values().length);
        assertNotNull(SingleInternalHelper.ToFlowable.valueOf("INSTANCE"));
    }

    @Test
    public void singleIterableToFlowableIterable() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 40

              
    @Test
    public void toFlowableEnum() {
        assertEquals(1, SingleInternalHelper.ToFlowable.values().length);
        assertNotNull(SingleInternalHelper.ToFlowable.valueOf("INSTANCE"));
    }

    @Test
    public void singleIterableToFlowableIterable() {

            

Reported by PMD.

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

Line: 36

                  }

    @Test
    public void mostRecent() {
        Subject<String> s = PublishSubject.create();

        Iterator<String> it = mostRecent(s, "default").iterator();

        assertTrue(it.hasNext());

            

Reported by PMD.

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

Line: 39

                  public void mostRecent() {
        Subject<String> s = PublishSubject.create();

        Iterator<String> it = mostRecent(s, "default").iterator();

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


            

Reported by PMD.

The String literal 'default' appears 6 times in this file; the first occurrence is on line 39
Error

Line: 39

                  public void mostRecent() {
        Subject<String> s = PublishSubject.create();

        Iterator<String> it = mostRecent(s, "default").iterator();

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


            

Reported by PMD.

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

Line: 45

                      assertEquals("default", it.next());
        assertEquals("default", it.next());

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

        s.onNext("two");

            

Reported by PMD.

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

Line: 50

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

        s.onNext("two");
        assertTrue(it.hasNext());
        assertEquals("two", it.next());
        assertEquals("two", it.next());

        s.onComplete();

            

Reported by PMD.

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

Line: 55

                      assertEquals("two", it.next());
        assertEquals("two", it.next());

        s.onComplete();
        assertFalse(it.hasNext());

    }

    @Test(expected = TestException.class)

            

Reported by PMD.

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

Line: 64

                  public void mostRecentWithException() {
        Subject<String> s = PublishSubject.create();

        Iterator<String> it = mostRecent(s, "default").iterator();

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


            

Reported by PMD.

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

Line: 79

                  @Test
    public void singleSourceManyIterators() {
        TestScheduler scheduler = new TestScheduler();
        Observable<Long> source = Observable.interval(1, TimeUnit.SECONDS, scheduler).take(10);

        Iterable<Long> iter = source.blockingMostRecent(-1L);

        for (int j = 0; j < 3; j++) {
            Iterator<Long> it = iter.iterator();

            

Reported by PMD.

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

Line: 81

                      TestScheduler scheduler = new TestScheduler();
        Observable<Long> source = Observable.interval(1, TimeUnit.SECONDS, scheduler).take(10);

        Iterable<Long> iter = source.blockingMostRecent(-1L);

        for (int j = 0; j < 3; j++) {
            Iterator<Long> it = iter.iterator();

            Assert.assertEquals(Long.valueOf(-1), it.next());

            

Reported by PMD.

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

Line: 103

              
    @Test
    public void empty() {
        Iterator<Integer> it = Observable.<Integer>empty()
        .blockingMostRecent(1)
        .iterator();

        try {
            it.next();

            

Reported by PMD.

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

Line: 28

              public class SingleDematerializeTest extends RxJavaTest {

    @Test
    public void success() {
        Single.just(Notification.createOnNext(1))
        .dematerialize(Functions.<Notification<Integer>>identity())
        .test()
        .assertResult(1);
    }

            

Reported by PMD.

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

Line: 29

              
    @Test
    public void success() {
        Single.just(Notification.createOnNext(1))
        .dematerialize(Functions.<Notification<Integer>>identity())
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 29

              
    @Test
    public void success() {
        Single.just(Notification.createOnNext(1))
        .dematerialize(Functions.<Notification<Integer>>identity())
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 29

              
    @Test
    public void success() {
        Single.just(Notification.createOnNext(1))
        .dematerialize(Functions.<Notification<Integer>>identity())
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 36

                  }

    @Test
    public void empty() {
        Single.just(Notification.<Integer>createOnComplete())
        .dematerialize(Functions.<Notification<Integer>>identity())
        .test()
        .assertResult();
    }

            

Reported by PMD.

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

Line: 37

              
    @Test
    public void empty() {
        Single.just(Notification.<Integer>createOnComplete())
        .dematerialize(Functions.<Notification<Integer>>identity())
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 37

              
    @Test
    public void empty() {
        Single.just(Notification.<Integer>createOnComplete())
        .dematerialize(Functions.<Notification<Integer>>identity())
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 37

              
    @Test
    public void empty() {
        Single.just(Notification.<Integer>createOnComplete())
        .dematerialize(Functions.<Notification<Integer>>identity())
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 44

                  }

    @Test
    public void error() {
        Single.<Notification<Integer>>error(new TestException())
        .dematerialize(Functions.<Notification<Integer>>identity())
        .test()
        .assertFailure(TestException.class);
    }

            

Reported by PMD.

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

Line: 52

                  }

    @Test
    public void errorNotification() {
        Single.just(Notification.<Integer>createOnError(new TestException()))
        .dematerialize(Functions.<Notification<Integer>>identity())
        .test()
        .assertFailure(TestException.class);
    }

            

Reported by PMD.

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

Line: 31

              public class SingleMapOptionalTest extends RxJavaTest {

    @Test
    public void successSuccess() {
        Single.just(1)
        .mapOptional(Optional::of)
        .test()
        .assertResult(1);
    }

            

Reported by PMD.

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

Line: 32

              
    @Test
    public void successSuccess() {
        Single.just(1)
        .mapOptional(Optional::of)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 32

              
    @Test
    public void successSuccess() {
        Single.just(1)
        .mapOptional(Optional::of)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 32

              
    @Test
    public void successSuccess() {
        Single.just(1)
        .mapOptional(Optional::of)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 39

                  }

    @Test
    public void successEmpty() {
        Single.just(1)
        .mapOptional(v -> Optional.empty())
        .test()
        .assertResult();
    }

            

Reported by PMD.

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

Line: 40

              
    @Test
    public void successEmpty() {
        Single.just(1)
        .mapOptional(v -> Optional.empty())
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 40

              
    @Test
    public void successEmpty() {
        Single.just(1)
        .mapOptional(v -> Optional.empty())
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 40

              
    @Test
    public void successEmpty() {
        Single.just(1)
        .mapOptional(v -> Optional.empty())
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 56

                      .test()
        .assertFailure(TestException.class);

        verify(f, never()).apply(any());
    }

    @Test
    public void mapperCrash() {
        Single.just(1)

            

Reported by PMD.

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

Line: 60

                  }

    @Test
    public void mapperCrash() {
        Single.just(1)
        .mapOptional(v -> { throw new TestException(); })
        .test()
        .assertFailure(TestException.class);
    }

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/core/TransformerTest.java
18 issues
This class has too many methods, consider refactoring it.
Design

Line: 24

              import io.reactivex.rxjava3.core.ConverterTest.*;
import io.reactivex.rxjava3.exceptions.TestException;

public class TransformerTest extends RxJavaTest {

    @Test
    public void flowableTransformerThrows() {
        try {
            Flowable.just(1).compose(new FlowableTransformer<Integer, Integer>() {

            

Reported by PMD.

The String literal 'Forced failure' appears 10 times in this file; the first occurrence is on line 32
Error

Line: 32

                          Flowable.just(1).compose(new FlowableTransformer<Integer, Integer>() {
                @Override
                public Publisher<Integer> apply(Flowable<Integer> v) {
                    throw new TestException("Forced failure");
                }
            });
            fail("Should have thrown!");
        } catch (TestException ex) {
            assertEquals("Forced failure", ex.getMessage());

            

Reported by PMD.

The String literal 'Should have thrown!' appears 5 times in this file; the first occurrence is on line 35
Error

Line: 35

                                  throw new TestException("Forced failure");
                }
            });
            fail("Should have thrown!");
        } catch (TestException ex) {
            assertEquals("Forced failure", ex.getMessage());
        }
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 37

                          });
            fail("Should have thrown!");
        } catch (TestException ex) {
            assertEquals("Forced failure", ex.getMessage());
        }
    }

    @Test
    public void observableTransformerThrows() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 52

                          });
            fail("Should have thrown!");
        } catch (TestException ex) {
            assertEquals("Forced failure", ex.getMessage());
        }
    }

    @Test
    public void singleTransformerThrows() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 67

                          });
            fail("Should have thrown!");
        } catch (TestException ex) {
            assertEquals("Forced failure", ex.getMessage());
        }
    }

    @Test
    public void maybeTransformerThrows() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 82

                          });
            fail("Should have thrown!");
        } catch (TestException ex) {
            assertEquals("Forced failure", ex.getMessage());
        }
    }

    @Test
    public void completableTransformerThrows() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 97

                          });
            fail("Should have thrown!");
        } catch (TestException ex) {
            assertEquals("Forced failure", ex.getMessage());
        }
    }

    // Test demos for signature generics in compose() methods. Just needs to compile.


            

Reported by PMD.

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

Line: 104

                  // Test demos for signature generics in compose() methods. Just needs to compile.

    @Test
    public void observableGenericsSignatureTest() {
        A<String, Integer> a = new A<String, Integer>() { };

        Observable.just(a).compose(TransformerTest.<String>testObservableTransformerCreator());
    }


            

Reported by PMD.

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

Line: 107

                  public void observableGenericsSignatureTest() {
        A<String, Integer> a = new A<String, Integer>() { };

        Observable.just(a).compose(TransformerTest.<String>testObservableTransformerCreator());
    }

    @Test
    public void singleGenericsSignatureTest() {
        A<String, Integer> a = new A<String, Integer>() { };

            

Reported by PMD.

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

Line: 28

              public class SingleConcatMapCompletableTest extends RxJavaTest {

    @Test
    public void dispose() {
        TestHelper.checkDisposed(Single.just(1).concatMapCompletable(new Function<Integer, Completable>() {
            @Override
            public Completable apply(Integer v) throws Exception {
                return Completable.complete();
            }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 56

                      .test()
        .assertResult();

        assertTrue(b[0]);
    }

    @Test
    public void error() {
        final boolean[] b = { false };

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 78

                      .test()
        .assertFailure(TestException.class);

        assertFalse(b[0]);
    }

    @Test
    public void mapperThrows() {
        final boolean[] b = { false };

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 95

                      .test()
        .assertFailure(TestException.class);

        assertFalse(b[0]);
    }

    @Test
    public void mapperReturnsNull() {
        final boolean[] b = { false };

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 112

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

        assertFalse(b[0]);
    }
}

            

Reported by PMD.

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

Line: 16

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

import static org.junit.Assert.*;

import org.junit.Test;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.TestException;

            

Reported by PMD.

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

Line: 20

              
import org.junit.Test;

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

public class SingleConcatMapCompletableTest extends RxJavaTest {

            

Reported by PMD.

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

Line: 22

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

public class SingleConcatMapCompletableTest extends RxJavaTest {

    @Test

            

Reported by PMD.

Found 'DU'-anomaly for variable 'b' (lines '39'-'57').
Error

Line: 39

              
    @Test
    public void normal() {
        final boolean[] b = { false };

        Single.just(1)
        .concatMapCompletable(new Function<Integer, Completable>() {
            @Override
            public Completable apply(Integer t) throws Exception {

            

Reported by PMD.

Found 'DU'-anomaly for variable 'b' (lines '39'-'57').
Error

Line: 39

              
    @Test
    public void normal() {
        final boolean[] b = { false };

        Single.just(1)
        .concatMapCompletable(new Function<Integer, Completable>() {
            @Override
            public Completable apply(Integer t) throws Exception {

            

Reported by PMD.