The following issues were found

src/test/java/io/reactivex/rxjava3/parallel/ParallelJoinTest.java
147 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.parallel;

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

import org.junit.Test;

            

Reported by PMD.

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

Line: 31

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

public class ParallelJoinTest extends RxJavaTest {

    @Test
    public void overflowFastpath() {
        new ParallelFlowable<Integer>() {
            @Override

            

Reported by PMD.

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

Line: 34

              public class ParallelJoinTest extends RxJavaTest {

    @Test
    public void overflowFastpath() {
        new ParallelFlowable<Integer>() {
            @Override
            public void subscribe(Subscriber<? super Integer>[] subscribers) {
                subscribers[0].onSubscribe(new BooleanSubscription());
                subscribers[0].onNext(1);

            

Reported by PMD.

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

Line: 55

                  }

    @Test
    public void overflowSlowpath() {
        @SuppressWarnings("unchecked")
        final Subscriber<? super Integer>[] subs = new Subscriber[1];

        TestSubscriber<Integer> ts = new TestSubscriber<Integer>(1) {
            @Override

            

Reported by PMD.

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

Line: 88

                  }

    @Test
    public void emptyBackpressured() {
        Flowable.empty()
        .parallel()
        .sequential()
        .test(0)
        .assertResult();

            

Reported by PMD.

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

Line: 89

              
    @Test
    public void emptyBackpressured() {
        Flowable.empty()
        .parallel()
        .sequential()
        .test(0)
        .assertResult();
    }

            

Reported by PMD.

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

Line: 89

              
    @Test
    public void emptyBackpressured() {
        Flowable.empty()
        .parallel()
        .sequential()
        .test(0)
        .assertResult();
    }

            

Reported by PMD.

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

Line: 89

              
    @Test
    public void emptyBackpressured() {
        Flowable.empty()
        .parallel()
        .sequential()
        .test(0)
        .assertResult();
    }

            

Reported by PMD.

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

Line: 89

              
    @Test
    public void emptyBackpressured() {
        Flowable.empty()
        .parallel()
        .sequential()
        .test(0)
        .assertResult();
    }

            

Reported by PMD.

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

Line: 97

                  }

    @Test
    public void overflowFastpathDelayError() {
        new ParallelFlowable<Integer>() {
            @Override
            public void subscribe(Subscriber<? super Integer>[] subscribers) {
                subscribers[0].onSubscribe(new BooleanSubscription());
                subscribers[0].onNext(1);

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsObservableTest.java
145 issues
This class has too many methods, consider refactoring it.
Design

Line: 35

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

public class MaybeFlattenStreamAsObservableTest extends RxJavaTest {

    @Test
    public void successJust() {
        Maybe.just(1)
        .flattenStreamAsObservable(Stream::of)

            

Reported by PMD.

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

Line: 38

              public class MaybeFlattenStreamAsObservableTest extends RxJavaTest {

    @Test
    public void successJust() {
        Maybe.just(1)
        .flattenStreamAsObservable(Stream::of)
        .test()
        .assertResult(1);
    }

            

Reported by PMD.

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

Line: 39

              
    @Test
    public void successJust() {
        Maybe.just(1)
        .flattenStreamAsObservable(Stream::of)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 39

              
    @Test
    public void successJust() {
        Maybe.just(1)
        .flattenStreamAsObservable(Stream::of)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 39

              
    @Test
    public void successJust() {
        Maybe.just(1)
        .flattenStreamAsObservable(Stream::of)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 46

                  }

    @Test
    public void successEmpty() {
        Maybe.just(1)
        .flattenStreamAsObservable(v -> Stream.of())
        .test()
        .assertResult();
    }

            

Reported by PMD.

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

Line: 47

              
    @Test
    public void successEmpty() {
        Maybe.just(1)
        .flattenStreamAsObservable(v -> Stream.of())
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 47

              
    @Test
    public void successEmpty() {
        Maybe.just(1)
        .flattenStreamAsObservable(v -> Stream.of())
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 47

              
    @Test
    public void successEmpty() {
        Maybe.just(1)
        .flattenStreamAsObservable(v -> Stream.of())
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 54

                  }

    @Test
    public void successMany() {
        Maybe.just(1)
        .flattenStreamAsObservable(v -> Stream.of(2, 3, 4, 5, 6))
        .test()
        .assertResult(2, 3, 4, 5, 6);
    }

            

Reported by PMD.

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

Line: 459

                      .blockingForEach(new Consumer<HashMap<String, String>>() {
            @Override
            public void accept(HashMap<String, String> v) {
                System.out.println(v);
            }
        });
    }

    @Test

            

Reported by PMD.

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.*;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;


            

Reported by PMD.

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

Line: 37

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

public class FlowableScanTest extends RxJavaTest {

    @Test
    public void scanIntegersWithInitialValue() {
        Subscriber<String> subscriber = TestHelper.mockSubscriber();


            

Reported by PMD.

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

Line: 55

                      });
        m.subscribe(subscriber);

        verify(subscriber, never()).onError(any(Throwable.class));
        verify(subscriber, times(1)).onNext("");
        verify(subscriber, times(1)).onNext("1");
        verify(subscriber, times(1)).onNext("12");
        verify(subscriber, times(1)).onNext("123");
        verify(subscriber, times(4)).onNext(anyString());

            

Reported by PMD.

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

Line: 56

                      m.subscribe(subscriber);

        verify(subscriber, never()).onError(any(Throwable.class));
        verify(subscriber, times(1)).onNext("");
        verify(subscriber, times(1)).onNext("1");
        verify(subscriber, times(1)).onNext("12");
        verify(subscriber, times(1)).onNext("123");
        verify(subscriber, times(4)).onNext(anyString());
        verify(subscriber, times(1)).onComplete();

            

Reported by PMD.

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

Line: 57

              
        verify(subscriber, never()).onError(any(Throwable.class));
        verify(subscriber, times(1)).onNext("");
        verify(subscriber, times(1)).onNext("1");
        verify(subscriber, times(1)).onNext("12");
        verify(subscriber, times(1)).onNext("123");
        verify(subscriber, times(4)).onNext(anyString());
        verify(subscriber, times(1)).onComplete();
        verify(subscriber, never()).onError(any(Throwable.class));

            

Reported by PMD.

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

Line: 58

                      verify(subscriber, never()).onError(any(Throwable.class));
        verify(subscriber, times(1)).onNext("");
        verify(subscriber, times(1)).onNext("1");
        verify(subscriber, times(1)).onNext("12");
        verify(subscriber, times(1)).onNext("123");
        verify(subscriber, times(4)).onNext(anyString());
        verify(subscriber, times(1)).onComplete();
        verify(subscriber, never()).onError(any(Throwable.class));
    }

            

Reported by PMD.

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

Line: 59

                      verify(subscriber, times(1)).onNext("");
        verify(subscriber, times(1)).onNext("1");
        verify(subscriber, times(1)).onNext("12");
        verify(subscriber, times(1)).onNext("123");
        verify(subscriber, times(4)).onNext(anyString());
        verify(subscriber, times(1)).onComplete();
        verify(subscriber, never()).onError(any(Throwable.class));
    }


            

Reported by PMD.

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

Line: 60

                      verify(subscriber, times(1)).onNext("1");
        verify(subscriber, times(1)).onNext("12");
        verify(subscriber, times(1)).onNext("123");
        verify(subscriber, times(4)).onNext(anyString());
        verify(subscriber, times(1)).onComplete();
        verify(subscriber, never()).onError(any(Throwable.class));
    }

    @Test

            

Reported by PMD.

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

Line: 61

                      verify(subscriber, times(1)).onNext("12");
        verify(subscriber, times(1)).onNext("123");
        verify(subscriber, times(4)).onNext(anyString());
        verify(subscriber, times(1)).onComplete();
        verify(subscriber, never()).onError(any(Throwable.class));
    }

    @Test
    public void scanIntegersWithoutInitialValue() {

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/util/QueueDrainHelperTest.java
144 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.util;

import static org.junit.Assert.*;

import java.io.IOException;
import java.util.*;

            

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

    @Test
    public void isCancelled() {
        assertTrue(QueueDrainHelper.isCancelled(new BooleanSupplier() {
            @Override

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 40

              
    @Test
    public void isCancelled() {
        assertTrue(QueueDrainHelper.isCancelled(new BooleanSupplier() {
            @Override
            public boolean getAsBoolean() throws Exception {
                throw new IOException();
            }
        }));

            

Reported by PMD.

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

Line: 49

                  }

    @Test
    public void requestMaxInt() {
        QueueDrainHelper.request(new Subscription() {
            @Override
            public void request(long n) {
                assertEquals(Integer.MAX_VALUE, n);
            }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 53

                      QueueDrainHelper.request(new Subscription() {
            @Override
            public void request(long n) {
                assertEquals(Integer.MAX_VALUE, n);
            }

            @Override
            public void cancel() {
            }

            

Reported by PMD.

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

Line: 63

                  }

    @Test
    public void requestMinInt() {
        QueueDrainHelper.request(new Subscription() {
            @Override
            public void request(long n) {
                assertEquals(Long.MAX_VALUE, n);
            }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 67

                      QueueDrainHelper.request(new Subscription() {
            @Override
            public void request(long n) {
                assertEquals(Long.MAX_VALUE, n);
            }

            @Override
            public void cancel() {
            }

            

Reported by PMD.

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

Line: 77

                  }

    @Test
    public void requestAlmostMaxInt() {
        QueueDrainHelper.request(new Subscription() {
            @Override
            public void request(long n) {
                assertEquals(Integer.MAX_VALUE - 1, n);
            }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 81

                      QueueDrainHelper.request(new Subscription() {
            @Override
            public void request(long n) {
                assertEquals(Integer.MAX_VALUE - 1, n);
            }

            @Override
            public void cancel() {
            }

            

Reported by PMD.

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

Line: 91

                  }

    @Test
    public void postCompleteEmpty() {
        TestSubscriber<Integer> ts = new TestSubscriber<>();
        ArrayDeque<Integer> queue = new ArrayDeque<>();
        AtomicLong state = new AtomicLong();
        BooleanSupplier isCancelled = new BooleanSupplier() {
            @Override

            

Reported by PMD.

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

Line: 83

              
            @Override
            public void onComplete() {
                System.out.println("onComplete");
                latch.countDown();
            }

            @Override
            public void onError(Throwable e) {

            

Reported by PMD.

System.out.println is used
Design

Line: 95

              
            @Override
            public void onNext(String t) {
                System.out.println("Received: " + t);
                // request more each time we receive
                request(1);
            }

        };

            

Reported by PMD.

System.out.println is used
Design

Line: 130

              
            @Override
            public void onComplete() {
                System.out.println("onComplete");
                latch.countDown();
            }

            @Override
            public void onError(Throwable e) {

            

Reported by PMD.

System.out.println is used
Design

Line: 142

              
            @Override
            public void onNext(Integer t) {
                System.out.println("Received: " + t);
                // request more each time we receive
                request(1);
            }
        };
        // this means it will only request 1 item and expect to receive more

            

Reported by PMD.

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.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;

import java.io.IOException;

            

Reported by PMD.

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

Line: 38

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

public class FlowableFilterTest extends RxJavaTest {

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

            

Reported by PMD.

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

Line: 42

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

            @Override
            public boolean test(String t1) {
                return t1.equals("two");

            

Reported by PMD.

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

Line: 42

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

            @Override
            public boolean test(String t1) {
                return t1.equals("two");

            

Reported by PMD.

Position literals first in String comparisons
Design

Line: 47

              
            @Override
            public boolean test(String t1) {
                return t1.equals("two");
            }
        });

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


            

Reported by PMD.

Position literals first in String comparisons
Design

Line: 47

              
            @Override
            public boolean test(String t1) {
                return t1.equals("two");
            }
        });

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


            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableMaterializeTest.java
143 issues
Avoid throwing raw exception types.
Design

Line: 47

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

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

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 75

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

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

            

Reported by PMD.

System.out.println is used
Design

Line: 245

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

                            }

            

Reported by PMD.

System.out.println is used
Design

Line: 257

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

            });
            t.start();

            

Reported by PMD.

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

Line: 31

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

public class FlowableMaterializeTest extends RxJavaTest {

    @Test
    public void materialize1() {
        // null will cause onError to be triggered before "three" can be
        // returned

            

Reported by PMD.

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

Line: 34

              public class FlowableMaterializeTest extends RxJavaTest {

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


            

Reported by PMD.

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

Line: 37

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

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

            

Reported by PMD.

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

Line: 37

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

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

            

Reported by PMD.

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

Line: 38

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

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


            

Reported by PMD.

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

Line: 41

                              "three");

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

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

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/exceptions/CompositeExceptionTest.java
143 issues
System.err.println is used
Design

Line: 47

                      Throwable e3 = new Throwable("3", rootCause);
        CompositeException ce = new CompositeException(e1, e2, e3);

        System.err.println("----------------------------- print composite stacktrace");
        ce.printStackTrace();
        assertEquals(3, ce.getExceptions().size());

        assertNoCircularReferences(ce);
        assertNotNull(getRootCause(ce));

            

Reported by PMD.

System.err.println is used
Design

Line: 53

              
        assertNoCircularReferences(ce);
        assertNotNull(getRootCause(ce));
        System.err.println("----------------------------- print cause stacktrace");
        ce.getCause().printStackTrace();
    }

    @Test
    public void emptyErrors() {

            

Reported by PMD.

System.err.println is used
Design

Line: 77

                  public void compositeExceptionFromParentThenChild() {
        CompositeException cex = new CompositeException(ex1, ex2);

        System.err.println("----------------------------- print composite stacktrace");
        cex.printStackTrace();
        assertEquals(2, cex.getExceptions().size());

        assertNoCircularReferences(cex);
        assertNotNull(getRootCause(cex));

            

Reported by PMD.

System.err.println is used
Design

Line: 84

                      assertNoCircularReferences(cex);
        assertNotNull(getRootCause(cex));

        System.err.println("----------------------------- print cause stacktrace");
        cex.getCause().printStackTrace();
    }

    @Test
    public void compositeExceptionFromChildThenParent() {

            

Reported by PMD.

System.err.println is used
Design

Line: 92

                  public void compositeExceptionFromChildThenParent() {
        CompositeException cex = new CompositeException(ex2, ex1);

        System.err.println("----------------------------- print composite stacktrace");
        cex.printStackTrace();
        assertEquals(2, cex.getExceptions().size());

        assertNoCircularReferences(cex);
        assertNotNull(getRootCause(cex));

            

Reported by PMD.

System.err.println is used
Design

Line: 99

                      assertNoCircularReferences(cex);
        assertNotNull(getRootCause(cex));

        System.err.println("----------------------------- print cause stacktrace");
        cex.getCause().printStackTrace();
    }

    @Test
    public void compositeExceptionFromChildAndComposite() {

            

Reported by PMD.

System.err.println is used
Design

Line: 107

                  public void compositeExceptionFromChildAndComposite() {
        CompositeException cex = new CompositeException(ex1, getNewCompositeExceptionWithEx123());

        System.err.println("----------------------------- print composite stacktrace");
        cex.printStackTrace();
        assertEquals(3, cex.getExceptions().size());

        assertNoCircularReferences(cex);
        assertNotNull(getRootCause(cex));

            

Reported by PMD.

System.err.println is used
Design

Line: 114

                      assertNoCircularReferences(cex);
        assertNotNull(getRootCause(cex));

        System.err.println("----------------------------- print cause stacktrace");
        cex.getCause().printStackTrace();
    }

    @Test
    public void compositeExceptionFromCompositeAndChild() {

            

Reported by PMD.

System.err.println is used
Design

Line: 122

                  public void compositeExceptionFromCompositeAndChild() {
        CompositeException cex = new CompositeException(getNewCompositeExceptionWithEx123(), ex1);

        System.err.println("----------------------------- print composite stacktrace");
        cex.printStackTrace();
        assertEquals(3, cex.getExceptions().size());

        assertNoCircularReferences(cex);
        assertNotNull(getRootCause(cex));

            

Reported by PMD.

System.err.println is used
Design

Line: 129

                      assertNoCircularReferences(cex);
        assertNotNull(getRootCause(cex));

        System.err.println("----------------------------- print cause stacktrace");
        cex.getCause().printStackTrace();
    }

    @Test
    public void compositeExceptionFromTwoDuplicateComposites() {

            

Reported by PMD.

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

Line: 77

                          @Override
            public String apply(String s) {
                if ("fail".equals(s)) {
                    throw new RuntimeException("Forced Failure");
                }
                return s;
            }
        });


            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 106

                          @Override
            public void accept(String s) {
                if ("fail".equals(s)) {
                    throw new RuntimeException("Forced Failure");
                }
            }
        });

        doOnEach.subscribe(subscribedObserver);

            

Reported by PMD.

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.observable;

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

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

public class ObservableDoOnEachTest extends RxJavaTest {

    Observer<String> subscribedObserver;
    Observer<String> sideEffectObserver;

    @Before

            

Reported by PMD.

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

Line: 39

              
public class ObservableDoOnEachTest extends RxJavaTest {

    Observer<String> subscribedObserver;
    Observer<String> sideEffectObserver;

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

            

Reported by PMD.

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

Line: 40

              public class ObservableDoOnEachTest extends RxJavaTest {

    Observer<String> subscribedObserver;
    Observer<String> sideEffectObserver;

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

            

Reported by PMD.

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

Line: 51

                  @Test
    public void doOnEach() {
        Observable<String> base = Observable.just("a", "b", "c");
        Observable<String> doOnEach = base.doOnEach(sideEffectObserver);

        doOnEach.subscribe(subscribedObserver);

        // ensure the leaf Observer is still getting called
        verify(subscribedObserver, never()).onError(any(Throwable.class));

            

Reported by PMD.

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

Line: 53

                      Observable<String> base = Observable.just("a", "b", "c");
        Observable<String> doOnEach = base.doOnEach(sideEffectObserver);

        doOnEach.subscribe(subscribedObserver);

        // ensure the leaf Observer is still getting called
        verify(subscribedObserver, never()).onError(any(Throwable.class));
        verify(subscribedObserver, times(1)).onNext("a");
        verify(subscribedObserver, times(1)).onNext("b");

            

Reported by PMD.

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

Line: 56

                      doOnEach.subscribe(subscribedObserver);

        // ensure the leaf Observer is still getting called
        verify(subscribedObserver, never()).onError(any(Throwable.class));
        verify(subscribedObserver, times(1)).onNext("a");
        verify(subscribedObserver, times(1)).onNext("b");
        verify(subscribedObserver, times(1)).onNext("c");
        verify(subscribedObserver, times(1)).onComplete();


            

Reported by PMD.

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

Line: 57

              
        // ensure the leaf Observer is still getting called
        verify(subscribedObserver, never()).onError(any(Throwable.class));
        verify(subscribedObserver, times(1)).onNext("a");
        verify(subscribedObserver, times(1)).onNext("b");
        verify(subscribedObserver, times(1)).onNext("c");
        verify(subscribedObserver, times(1)).onComplete();

        // ensure our injected Observer is getting called

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/jdk8/MaybeFlattenStreamAsFlowableTest.java
142 issues
This class has too many methods, consider refactoring it.
Design

Line: 37

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

public class MaybeFlattenStreamAsFlowableTest extends RxJavaTest {

    @Test
    public void successJust() {
        Maybe.just(1)
        .flattenStreamAsFlowable(Stream::of)

            

Reported by PMD.

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

Line: 40

              public class MaybeFlattenStreamAsFlowableTest extends RxJavaTest {

    @Test
    public void successJust() {
        Maybe.just(1)
        .flattenStreamAsFlowable(Stream::of)
        .test()
        .assertResult(1);
    }

            

Reported by PMD.

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

Line: 41

              
    @Test
    public void successJust() {
        Maybe.just(1)
        .flattenStreamAsFlowable(Stream::of)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 41

              
    @Test
    public void successJust() {
        Maybe.just(1)
        .flattenStreamAsFlowable(Stream::of)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 41

              
    @Test
    public void successJust() {
        Maybe.just(1)
        .flattenStreamAsFlowable(Stream::of)
        .test()
        .assertResult(1);
    }


            

Reported by PMD.

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

Line: 48

                  }

    @Test
    public void successEmpty() {
        Maybe.just(1)
        .flattenStreamAsFlowable(v -> Stream.of())
        .test()
        .assertResult();
    }

            

Reported by PMD.

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

Line: 49

              
    @Test
    public void successEmpty() {
        Maybe.just(1)
        .flattenStreamAsFlowable(v -> Stream.of())
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 49

              
    @Test
    public void successEmpty() {
        Maybe.just(1)
        .flattenStreamAsFlowable(v -> Stream.of())
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 49

              
    @Test
    public void successEmpty() {
        Maybe.just(1)
        .flattenStreamAsFlowable(v -> Stream.of())
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 56

                  }

    @Test
    public void successMany() {
        Maybe.just(1)
        .flattenStreamAsFlowable(v -> Stream.of(2, 3, 4, 5, 6))
        .test()
        .assertResult(2, 3, 4, 5, 6);
    }

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/core/XFlatMapTest.java
142 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 static org.junit.Assert.assertTrue;

import java.util.List;
import java.util.concurrent.CyclicBarrier;

            

Reported by PMD.

Avoid really long classes.
Design

Line: 32

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

public class XFlatMapTest extends RxJavaTest {

    @Rule
    public Retry retry = new Retry(5, 1000, true);

    static final int SLEEP_AFTER_CANCEL = 500;

            

Reported by PMD.

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

Line: 32

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

public class XFlatMapTest extends RxJavaTest {

    @Rule
    public Retry retry = new Retry(5, 1000, true);

    static final int SLEEP_AFTER_CANCEL = 500;

            

Reported by PMD.

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

Line: 39

              
    static final int SLEEP_AFTER_CANCEL = 500;

    final CyclicBarrier cb = new CyclicBarrier(2);

    void sleep() throws Exception {
        cb.await();
        try {
            long before = System.currentTimeMillis();

            

Reported by PMD.

Probable detached JUnit test case.
Error

Line: 41

              
    final CyclicBarrier cb = new CyclicBarrier(2);

    void sleep() throws Exception {
        cb.await();
        try {
            long before = System.currentTimeMillis();
            Thread.sleep(5000);
            throw new IllegalStateException("Was not interrupted in time?! " + (System.currentTimeMillis() - before));

            

Reported by PMD.

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

Line: 41

              
    final CyclicBarrier cb = new CyclicBarrier(2);

    void sleep() throws Exception {
        cb.await();
        try {
            long before = System.currentTimeMillis();
            Thread.sleep(5000);
            throw new IllegalStateException("Was not interrupted in time?! " + (System.currentTimeMillis() - before));

            

Reported by PMD.

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

Line: 52

                      }
    }

    void beforeCancelSleep(TestSubscriber<?> ts) throws Exception {
        long before = System.currentTimeMillis();
        Thread.sleep(50);
        if (System.currentTimeMillis() - before > 100) {
            ts.cancel();
            throw new IllegalStateException("Overslept?" + (System.currentTimeMillis() - before));

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 55

                  void beforeCancelSleep(TestSubscriber<?> ts) throws Exception {
        long before = System.currentTimeMillis();
        Thread.sleep(50);
        if (System.currentTimeMillis() - before > 100) {
            ts.cancel();
            throw new IllegalStateException("Overslept?" + (System.currentTimeMillis() - before));
        }
    }


            

Reported by PMD.

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

Line: 61

                      }
    }

    void beforeCancelSleep(TestObserver<?> to) throws Exception {
        long before = System.currentTimeMillis();
        Thread.sleep(50);
        if (System.currentTimeMillis() - before > 100) {
            to.dispose();
            throw new IllegalStateException("Overslept?" + (System.currentTimeMillis() - before));

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 64

                  void beforeCancelSleep(TestObserver<?> to) throws Exception {
        long before = System.currentTimeMillis();
        Thread.sleep(50);
        if (System.currentTimeMillis() - before > 100) {
            to.dispose();
            throw new IllegalStateException("Overslept?" + (System.currentTimeMillis() - before));
        }
    }


            

Reported by PMD.