The following issues were found

src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeDoOnTerminateTest.java
12 issues
JUnit assertions should include a message
Design

Line: 42

                      .test()
        .assertResult(1);

        assertTrue(atomicBoolean.get());
    }

    @Test
    public void doOnTerminateError() {
        final AtomicBoolean atomicBoolean = new AtomicBoolean();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 57

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

        assertTrue(atomicBoolean.get());
    }

    @Test
    public void doOnTerminateComplete() {
        final AtomicBoolean atomicBoolean = new AtomicBoolean();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 72

                      .test()
        .assertResult();

        assertTrue(atomicBoolean.get());
    }

    @Test
    public void doOnTerminateSuccessCrash() {
        Maybe.just(1).doOnTerminate(new Action() {

            

Reported by PMD.

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

Line: 76

                  }

    @Test
    public void doOnTerminateSuccessCrash() {
        Maybe.just(1).doOnTerminate(new Action() {
            @Override
            public void run() {
                throw new TestException();
            }

            

Reported by PMD.

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

Line: 88

                  }

    @Test
    public void doOnTerminateErrorCrash() {
        TestObserverEx<Object> to = Maybe.error(new TestException("Outer"))
        .doOnTerminate(new Action() {
            @Override
            public void run() {
                throw new TestException("Inner");

            

Reported by PMD.

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

Line: 99

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

        List<Throwable> errors = TestHelper.compositeList(to.errors().get(0));
        TestHelper.assertError(errors, 0, TestException.class, "Outer");
        TestHelper.assertError(errors, 1, TestException.class, "Inner");
    }

    @Test

            

Reported by PMD.

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

Line: 105

                  }

    @Test
    public void doOnTerminateCompleteCrash() {
        Maybe.empty()
        .doOnTerminate(new Action() {
            @Override
            public void run() {
                throw new TestException();

            

Reported by PMD.

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

Line: 23

              
import org.junit.Test;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.*;
import io.reactivex.rxjava3.functions.Action;
import io.reactivex.rxjava3.testsupport.*;

public class MaybeDoOnTerminateTest extends RxJavaTest {

            

Reported by PMD.

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

Line: 24

              import org.junit.Test;

import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.*;
import io.reactivex.rxjava3.functions.Action;
import io.reactivex.rxjava3.testsupport.*;

public class MaybeDoOnTerminateTest extends RxJavaTest {


            

Reported by PMD.

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

Line: 26

              import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.*;
import io.reactivex.rxjava3.functions.Action;
import io.reactivex.rxjava3.testsupport.*;

public class MaybeDoOnTerminateTest extends RxJavaTest {

    @Test
    public void doOnTerminateSuccess() {

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletableAwaitTest.java
12 issues
Potential violation of Law of Demeter (method chain calls)
Design

Line: 30

                  @Test
    public void awaitInterrupted() {

        Thread.currentThread().interrupt();

        try {
            PublishProcessor.create().ignoreElements().blockingAwait();
            fail("Should have thrown RuntimeException");
        } catch (RuntimeException ex) {

            

Reported by PMD.

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

Line: 33

                      Thread.currentThread().interrupt();

        try {
            PublishProcessor.create().ignoreElements().blockingAwait();
            fail("Should have thrown RuntimeException");
        } catch (RuntimeException ex) {
            if (!(ex.getCause() instanceof InterruptedException)) {
                fail("Wrong cause: " + ex.getCause());
            }

            

Reported by PMD.

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

Line: 33

                      Thread.currentThread().interrupt();

        try {
            PublishProcessor.create().ignoreElements().blockingAwait();
            fail("Should have thrown RuntimeException");
        } catch (RuntimeException ex) {
            if (!(ex.getCause() instanceof InterruptedException)) {
                fail("Wrong cause: " + ex.getCause());
            }

            

Reported by PMD.

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

Line: 35

                      try {
            PublishProcessor.create().ignoreElements().blockingAwait();
            fail("Should have thrown RuntimeException");
        } catch (RuntimeException ex) {
            if (!(ex.getCause() instanceof InterruptedException)) {
                fail("Wrong cause: " + ex.getCause());
            }
        }


            

Reported by PMD.

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

Line: 46

                  @Test
    public void awaitTimeoutInterrupted() {

        Thread.currentThread().interrupt();

        try {
            PublishProcessor.create().ignoreElements().blockingAwait(1, TimeUnit.SECONDS);
            fail("Should have thrown RuntimeException");
        } catch (RuntimeException ex) {

            

Reported by PMD.

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

Line: 49

                      Thread.currentThread().interrupt();

        try {
            PublishProcessor.create().ignoreElements().blockingAwait(1, TimeUnit.SECONDS);
            fail("Should have thrown RuntimeException");
        } catch (RuntimeException ex) {
            if (!(ex.getCause() instanceof InterruptedException)) {
                fail("Wrong cause: " + ex.getCause());
            }

            

Reported by PMD.

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

Line: 49

                      Thread.currentThread().interrupt();

        try {
            PublishProcessor.create().ignoreElements().blockingAwait(1, TimeUnit.SECONDS);
            fail("Should have thrown RuntimeException");
        } catch (RuntimeException ex) {
            if (!(ex.getCause() instanceof InterruptedException)) {
                fail("Wrong cause: " + ex.getCause());
            }

            

Reported by PMD.

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

Line: 51

                      try {
            PublishProcessor.create().ignoreElements().blockingAwait(1, TimeUnit.SECONDS);
            fail("Should have thrown RuntimeException");
        } catch (RuntimeException ex) {
            if (!(ex.getCause() instanceof InterruptedException)) {
                fail("Wrong cause: " + ex.getCause());
            }
        }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 61

              
    @Test
    public void awaitTimeout() {
        assertFalse(PublishProcessor.create().ignoreElements().blockingAwait(100, TimeUnit.MILLISECONDS));
    }
}

            

Reported by PMD.

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

Line: 61

              
    @Test
    public void awaitTimeout() {
        assertFalse(PublishProcessor.create().ignoreElements().blockingAwait(100, TimeUnit.MILLISECONDS));
    }
}

            

Reported by PMD.

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

Line: 35

              
    private static final TimeUnit TIME_UNIT = TimeUnit.MILLISECONDS;

    private Observer<Timed<Integer>> observer;

    private TestScheduler testScheduler;
    private PublishSubject<Integer> subject;
    private Observable<Timed<Integer>> observable;


            

Reported by PMD.

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

Line: 37

              
    private Observer<Timed<Integer>> observer;

    private TestScheduler testScheduler;
    private PublishSubject<Integer> subject;
    private Observable<Timed<Integer>> observable;

    @Before
    public void setUp() {

            

Reported by PMD.

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

Line: 38

                  private Observer<Timed<Integer>> observer;

    private TestScheduler testScheduler;
    private PublishSubject<Integer> subject;
    private Observable<Timed<Integer>> observable;

    @Before
    public void setUp() {
        observer = TestHelper.mockObserver();

            

Reported by PMD.

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

Line: 39

              
    private TestScheduler testScheduler;
    private PublishSubject<Integer> subject;
    private Observable<Timed<Integer>> observable;

    @Before
    public void setUp() {
        observer = TestHelper.mockObserver();
        testScheduler = new TestScheduler();

            

Reported by PMD.

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

Line: 68

                              new Timed<>(2, 2000, TIME_UNIT));
        inOrder.verify(observer, times(1)).onNext(
                new Timed<>(3, 3000, TIME_UNIT));
        inOrder.verify(observer, times(1)).onComplete();
        inOrder.verifyNoMoreInteractions();
    }

    @Test
    public void timeIntervalDefault() {

            

Reported by PMD.

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

Line: 68

                              new Timed<>(2, 2000, TIME_UNIT));
        inOrder.verify(observer, times(1)).onNext(
                new Timed<>(3, 3000, TIME_UNIT));
        inOrder.verify(observer, times(1)).onComplete();
        inOrder.verifyNoMoreInteractions();
    }

    @Test
    public void timeIntervalDefault() {

            

Reported by PMD.

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

Line: 69

                      inOrder.verify(observer, times(1)).onNext(
                new Timed<>(3, 3000, TIME_UNIT));
        inOrder.verify(observer, times(1)).onComplete();
        inOrder.verifyNoMoreInteractions();
    }

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

            

Reported by PMD.

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

Line: 128

              
    @Test
    public void dispose() {
        TestHelper.checkDisposed(Observable.just(1).timeInterval());
    }

    @Test
    public void error() {
        Observable.error(new TestException())

            

Reported by PMD.

Avoid unused imports such as 'org.mockito.Mockito'
Design

Line: 16

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

import static org.mockito.Mockito.*;

import java.util.concurrent.TimeUnit;

import org.junit.*;
import org.mockito.InOrder;

            

Reported by PMD.

Avoid unused imports such as 'org.junit'
Design

Line: 20

              
import java.util.concurrent.TimeUnit;

import org.junit.*;
import org.mockito.InOrder;

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

            

Reported by PMD.

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

Line: 28

              public class CompletableResumeNextTest extends RxJavaTest {

    @Test
    public void resumeNextError() {
        Completable.error(new TestException())
        .onErrorResumeNext(Functions.justFunction(Completable.error(new TestException("second"))))
        .to(TestHelper.<Object>testConsumer())
        .assertFailureAndMessage(TestException.class, "second");
    }

            

Reported by PMD.

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

Line: 36

                  }

    @Test
    public void disposeInMain() {
        TestHelper.checkDisposedCompletable(new Function<Completable, CompletableSource>() {
            @Override
            public CompletableSource apply(Completable c) throws Exception {
                return c.onErrorResumeNext(Functions.justFunction(Completable.complete()));
            }

            

Reported by PMD.

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

Line: 46

                  }

    @Test
    public void disposeInResume() {
        TestHelper.checkDisposedCompletable(new Function<Completable, CompletableSource>() {
            @Override
            public CompletableSource apply(Completable c) throws Exception {
                return Completable.error(new TestException()).onErrorResumeNext(Functions.justFunction(c));
            }

            

Reported by PMD.

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

Line: 56

                  }

    @Test
    public void disposed() {
        TestHelper.checkDisposed(
                Completable.error(new TestException())
                .onErrorResumeNext(Functions.justFunction(Completable.never()))
        );
    }

            

Reported by PMD.

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

Line: 67

                  public void resumeWithNoError() throws Throwable {
        Action action = mock(Action.class);

        Completable.complete()
        .onErrorResumeWith(Completable.fromAction(action))
        .test()
        .assertResult();

        verify(action, never()).run();

            

Reported by PMD.

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

Line: 67

                  public void resumeWithNoError() throws Throwable {
        Action action = mock(Action.class);

        Completable.complete()
        .onErrorResumeWith(Completable.fromAction(action))
        .test()
        .assertResult();

        verify(action, never()).run();

            

Reported by PMD.

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

Line: 67

                  public void resumeWithNoError() throws Throwable {
        Action action = mock(Action.class);

        Completable.complete()
        .onErrorResumeWith(Completable.fromAction(action))
        .test()
        .assertResult();

        verify(action, never()).run();

            

Reported by PMD.

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

Line: 72

                      .test()
        .assertResult();

        verify(action, never()).run();
    }

    @Test
    public void resumeWithError() throws Throwable {
        Action action = mock(Action.class);

            

Reported by PMD.

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

Line: 84

                      .test()
        .assertResult();

        verify(action).run();
    }
}

            

Reported by PMD.

Avoid unused imports such as 'org.mockito.Mockito'
Design

Line: 16

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

import static org.mockito.Mockito.*;
import org.junit.Test;

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

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/disposables/EmptyDisposableTest.java
12 issues
JUnit tests should include assert() or fail()
Design

Line: 27

              public class EmptyDisposableTest extends RxJavaTest {

    @Test
    public void noOffer() {
        TestHelper.assertNoOffer(EmptyDisposable.INSTANCE);
    }

    @Test
    public void asyncFusion() {

            

Reported by PMD.

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

Line: 32

                  }

    @Test
    public void asyncFusion() {
        assertEquals(QueueFuseable.NONE, EmptyDisposable.INSTANCE.requestFusion(QueueFuseable.SYNC));
        assertEquals(QueueFuseable.ASYNC, EmptyDisposable.INSTANCE.requestFusion(QueueFuseable.ASYNC));
    }

    @Test

            

Reported by PMD.

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

Line: 33

              
    @Test
    public void asyncFusion() {
        assertEquals(QueueFuseable.NONE, EmptyDisposable.INSTANCE.requestFusion(QueueFuseable.SYNC));
        assertEquals(QueueFuseable.ASYNC, EmptyDisposable.INSTANCE.requestFusion(QueueFuseable.ASYNC));
    }

    @Test
    public void checkEnum() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 33

              
    @Test
    public void asyncFusion() {
        assertEquals(QueueFuseable.NONE, EmptyDisposable.INSTANCE.requestFusion(QueueFuseable.SYNC));
        assertEquals(QueueFuseable.ASYNC, EmptyDisposable.INSTANCE.requestFusion(QueueFuseable.ASYNC));
    }

    @Test
    public void checkEnum() {

            

Reported by PMD.

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

Line: 34

                  @Test
    public void asyncFusion() {
        assertEquals(QueueFuseable.NONE, EmptyDisposable.INSTANCE.requestFusion(QueueFuseable.SYNC));
        assertEquals(QueueFuseable.ASYNC, EmptyDisposable.INSTANCE.requestFusion(QueueFuseable.ASYNC));
    }

    @Test
    public void checkEnum() {
        assertEquals(2, EmptyDisposable.values().length);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 34

                  @Test
    public void asyncFusion() {
        assertEquals(QueueFuseable.NONE, EmptyDisposable.INSTANCE.requestFusion(QueueFuseable.SYNC));
        assertEquals(QueueFuseable.ASYNC, EmptyDisposable.INSTANCE.requestFusion(QueueFuseable.ASYNC));
    }

    @Test
    public void checkEnum() {
        assertEquals(2, EmptyDisposable.values().length);

            

Reported by PMD.

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

Line: 38

                  }

    @Test
    public void checkEnum() {
        assertEquals(2, EmptyDisposable.values().length);
        assertNotNull(EmptyDisposable.valueOf("INSTANCE"));
        assertNotNull(EmptyDisposable.valueOf("NEVER"));
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 39

              
    @Test
    public void checkEnum() {
        assertEquals(2, EmptyDisposable.values().length);
        assertNotNull(EmptyDisposable.valueOf("INSTANCE"));
        assertNotNull(EmptyDisposable.valueOf("NEVER"));
    }
}

            

Reported by PMD.

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

Line: 39

              
    @Test
    public void checkEnum() {
        assertEquals(2, EmptyDisposable.values().length);
        assertNotNull(EmptyDisposable.valueOf("INSTANCE"));
        assertNotNull(EmptyDisposable.valueOf("NEVER"));
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 40

                  @Test
    public void checkEnum() {
        assertEquals(2, EmptyDisposable.values().length);
        assertNotNull(EmptyDisposable.valueOf("INSTANCE"));
        assertNotNull(EmptyDisposable.valueOf("NEVER"));
    }
}

            

Reported by PMD.

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

Line: 34

              public class SingleSafeSubscribeTest {

    @Test
    public void normalSuccess() throws Throwable {
        TestHelper.withErrorTracking(errors -> {
            @SuppressWarnings("unchecked")
            SingleObserver<Integer> consumer = mock(SingleObserver.class);

            Single.just(1)

            

Reported by PMD.

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

Line: 36

                  @Test
    public void normalSuccess() throws Throwable {
        TestHelper.withErrorTracking(errors -> {
            @SuppressWarnings("unchecked")
            SingleObserver<Integer> consumer = mock(SingleObserver.class);

            Single.just(1)
            .safeSubscribe(consumer);


            

Reported by PMD.

Do not add empty strings
Performance

Line: 47

                          order.verify(consumer).onSuccess(1);
            order.verifyNoMoreInteractions();

            assertTrue("" + errors, errors.isEmpty());
        });
    }

    @Test
    public void normalError() throws Throwable  {

            

Reported by PMD.

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

Line: 52

                  }

    @Test
    public void normalError() throws Throwable  {
        TestHelper.withErrorTracking(errors -> {
            @SuppressWarnings("unchecked")
            SingleObserver<Integer> consumer = mock(SingleObserver.class);

            Single.<Integer>error(new TestException())

            

Reported by PMD.

Do not add empty strings
Performance

Line: 65

                          order.verify(consumer).onError(any(TestException.class));
            order.verifyNoMoreInteractions();

            assertTrue("" + errors, errors.isEmpty());
        });
    }

    @Test
    public void onSubscribeCrash() throws Throwable {

            

Reported by PMD.

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

Line: 70

                  }

    @Test
    public void onSubscribeCrash() throws Throwable {
        TestHelper.withErrorTracking(errors -> {
            @SuppressWarnings("unchecked")
            SingleObserver<Integer> consumer = mock(SingleObserver.class);
            doThrow(new TestException()).when(consumer).onSubscribe(any());


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 93

                          order.verify(consumer).onSubscribe(any(Disposable.class));
            order.verifyNoMoreInteractions();

            assertTrue(d.isDisposed());

            TestHelper.assertUndeliverable(errors, 0, TestException.class);
            TestHelper.assertUndeliverable(errors, 1, IOException.class);
        });
    }

            

Reported by PMD.

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

Line: 101

                  }

    @Test
    public void onSuccessCrash() throws Throwable {
        TestHelper.withErrorTracking(errors -> {
            @SuppressWarnings("unchecked")
            SingleObserver<Integer> consumer = mock(SingleObserver.class);
            doThrow(new TestException()).when(consumer).onSuccess(any());


            

Reported by PMD.

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

Line: 126

                  }

    @Test
    public void onErrorCrash() throws Throwable  {
        TestHelper.withErrorTracking(errors -> {
            @SuppressWarnings("unchecked")
            SingleObserver<Integer> consumer = mock(SingleObserver.class);
            doThrow(new TestException()).when(consumer).onError(any());


            

Reported by PMD.

Avoid unused imports such as 'org.mockito.Mockito'
Design

Line: 18

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

import java.io.IOException;

import org.junit.Test;
import org.mockito.InOrder;

            

Reported by PMD.

src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeToCompletableTest.java
12 issues
JUnit assertions should include a message
Design

Line: 32

                  public void source() {
        Maybe<Integer> source = Maybe.just(1);

        assertSame(source, ((HasUpstreamMaybeSource<Integer>)source.ignoreElement().toMaybe()).source());
    }

    @Test
    public void dispose() {
        TestHelper.checkDisposed(Maybe.never().ignoreElement().toMaybe());

            

Reported by PMD.

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

Line: 32

                  public void source() {
        Maybe<Integer> source = Maybe.just(1);

        assertSame(source, ((HasUpstreamMaybeSource<Integer>)source.ignoreElement().toMaybe()).source());
    }

    @Test
    public void dispose() {
        TestHelper.checkDisposed(Maybe.never().ignoreElement().toMaybe());

            

Reported by PMD.

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

Line: 32

                  public void source() {
        Maybe<Integer> source = Maybe.just(1);

        assertSame(source, ((HasUpstreamMaybeSource<Integer>)source.ignoreElement().toMaybe()).source());
    }

    @Test
    public void dispose() {
        TestHelper.checkDisposed(Maybe.never().ignoreElement().toMaybe());

            

Reported by PMD.

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

Line: 36

                  }

    @Test
    public void dispose() {
        TestHelper.checkDisposed(Maybe.never().ignoreElement().toMaybe());
    }

    @Test
    public void successToComplete() {

            

Reported by PMD.

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

Line: 37

              
    @Test
    public void dispose() {
        TestHelper.checkDisposed(Maybe.never().ignoreElement().toMaybe());
    }

    @Test
    public void successToComplete() {
        Maybe.just(1)

            

Reported by PMD.

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

Line: 37

              
    @Test
    public void dispose() {
        TestHelper.checkDisposed(Maybe.never().ignoreElement().toMaybe());
    }

    @Test
    public void successToComplete() {
        Maybe.just(1)

            

Reported by PMD.

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

Line: 41

                  }

    @Test
    public void successToComplete() {
        Maybe.just(1)
        .ignoreElement()
        .test()
        .assertResult();
    }

            

Reported by PMD.

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

Line: 42

              
    @Test
    public void successToComplete() {
        Maybe.just(1)
        .ignoreElement()
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 42

              
    @Test
    public void successToComplete() {
        Maybe.just(1)
        .ignoreElement()
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 42

              
    @Test
    public void successToComplete() {
        Maybe.just(1)
        .ignoreElement()
        .test()
        .assertResult();
    }


            

Reported by PMD.

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

Line: 27

              public class SingleMaterializeTest extends RxJavaTest {

    @Test
    public void success() {
        Single.just(1)
        .materialize()
        .test()
        .assertResult(Notification.createOnNext(1));
    }

            

Reported by PMD.

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

Line: 28

              
    @Test
    public void success() {
        Single.just(1)
        .materialize()
        .test()
        .assertResult(Notification.createOnNext(1));
    }


            

Reported by PMD.

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

Line: 28

              
    @Test
    public void success() {
        Single.just(1)
        .materialize()
        .test()
        .assertResult(Notification.createOnNext(1));
    }


            

Reported by PMD.

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

Line: 28

              
    @Test
    public void success() {
        Single.just(1)
        .materialize()
        .test()
        .assertResult(Notification.createOnNext(1));
    }


            

Reported by PMD.

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

Line: 35

                  }

    @Test
    public void error() {
        TestException ex = new TestException();
        Maybe.error(ex)
        .materialize()
        .test()
        .assertResult(Notification.createOnError(ex));

            

Reported by PMD.

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

Line: 37

                  @Test
    public void error() {
        TestException ex = new TestException();
        Maybe.error(ex)
        .materialize()
        .test()
        .assertResult(Notification.createOnError(ex));
    }


            

Reported by PMD.

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

Line: 37

                  @Test
    public void error() {
        TestException ex = new TestException();
        Maybe.error(ex)
        .materialize()
        .test()
        .assertResult(Notification.createOnError(ex));
    }


            

Reported by PMD.

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

Line: 37

                  @Test
    public void error() {
        TestException ex = new TestException();
        Maybe.error(ex)
        .materialize()
        .test()
        .assertResult(Notification.createOnError(ex));
    }


            

Reported by PMD.

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

Line: 44

                  }

    @Test
    public void doubleOnSubscribe() {
        TestHelper.checkDoubleOnSubscribeSingle(new Function<Single<Object>, SingleSource<Notification<Object>>>() {
            @Override
            public SingleSource<Notification<Object>> apply(Single<Object> v) throws Exception {
                return v.materialize();
            }

            

Reported by PMD.

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

Line: 54

                  }

    @Test
    public void dispose() {
        TestHelper.checkDisposed(SingleSubject.create().materialize());
    }
}

            

Reported by PMD.

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

Line: 27

              public class CompletableMaterializeTest extends RxJavaTest {

    @Test
    public void error() {
        TestException ex = new TestException();
        Completable.error(ex)
        .materialize()
        .test()
        .assertResult(Notification.createOnError(ex));

            

Reported by PMD.

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

Line: 29

                  @Test
    public void error() {
        TestException ex = new TestException();
        Completable.error(ex)
        .materialize()
        .test()
        .assertResult(Notification.createOnError(ex));
    }


            

Reported by PMD.

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

Line: 29

                  @Test
    public void error() {
        TestException ex = new TestException();
        Completable.error(ex)
        .materialize()
        .test()
        .assertResult(Notification.createOnError(ex));
    }


            

Reported by PMD.

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

Line: 29

                  @Test
    public void error() {
        TestException ex = new TestException();
        Completable.error(ex)
        .materialize()
        .test()
        .assertResult(Notification.createOnError(ex));
    }


            

Reported by PMD.

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

Line: 36

                  }

    @Test
    public void empty() {
        Completable.complete()
        .materialize()
        .test()
        .assertResult(Notification.createOnComplete());
    }

            

Reported by PMD.

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

Line: 37

              
    @Test
    public void empty() {
        Completable.complete()
        .materialize()
        .test()
        .assertResult(Notification.createOnComplete());
    }


            

Reported by PMD.

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

Line: 37

              
    @Test
    public void empty() {
        Completable.complete()
        .materialize()
        .test()
        .assertResult(Notification.createOnComplete());
    }


            

Reported by PMD.

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

Line: 37

              
    @Test
    public void empty() {
        Completable.complete()
        .materialize()
        .test()
        .assertResult(Notification.createOnComplete());
    }


            

Reported by PMD.

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

Line: 44

                  }

    @Test
    public void doubleOnSubscribe() {
        TestHelper.checkDoubleOnSubscribeCompletableToSingle(new Function<Completable, SingleSource<Notification<Object>>>() {
            @Override
            public SingleSource<Notification<Object>> apply(Completable v) throws Exception {
                return v.materialize();
            }

            

Reported by PMD.

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

Line: 54

                  }

    @Test
    public void dispose() {
        TestHelper.checkDisposed(CompletableSubject.create().materialize());
    }
}

            

Reported by PMD.

src/main/java/io/reactivex/rxjava3/subjects/PublishSubject.java
12 issues
This class has too many methods, consider refactoring it.
Design

Line: 96

               * @param <T>
 *          the type of items observed and emitted by the Subject
 */
public final class PublishSubject<T> extends Subject<T> {
    /** The terminated indicator for the subscribers array. */
    @SuppressWarnings("rawtypes")
    static final PublishDisposable[] TERMINATED = new PublishDisposable[0];
    /** An empty subscribers array to avoid allocating it all the time. */
    @SuppressWarnings("rawtypes")

            

Reported by PMD.

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

Line: 105

                  static final PublishDisposable[] EMPTY = new PublishDisposable[0];

    /** The array of currently subscribed subscribers. */
    final AtomicReference<PublishDisposable<T>[]> subscribers;

    /** The error, write before terminating and read after checking subscribers. */
    Throwable error;

    /**

            

Reported by PMD.

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

Line: 108

                  final AtomicReference<PublishDisposable<T>[]> subscribers;

    /** The error, write before terminating and read after checking subscribers. */
    Throwable error;

    /**
     * Constructs a PublishSubject.
     * @param <T> the value type
     * @return the new PublishSubject

            

Reported by PMD.

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

Line: 125

                   * Constructs a PublishSubject.
     * @since 2.0
     */
    @SuppressWarnings("unchecked")
    PublishSubject() {
        subscribers = new AtomicReference<>(EMPTY);
    }

    @Override

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 165

              
            int n = a.length;
            @SuppressWarnings("unchecked")
            PublishDisposable<T>[] b = new PublishDisposable[n + 1];
            System.arraycopy(a, 0, b, 0, n);
            b[n] = ps;

            if (subscribers.compareAndSet(a, b)) {
                return true;

            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 202

              
            PublishDisposable<T>[] b;

            if (n == 1) {
                b = EMPTY;
            } else {
                b = new PublishDisposable[n - 1];
                System.arraycopy(a, 0, b, 0, j);
                System.arraycopy(a, j + 1, b, j, n - j - 1);

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 205

                          if (n == 1) {
                b = EMPTY;
            } else {
                b = new PublishDisposable[n - 1];
                System.arraycopy(a, 0, b, 0, j);
                System.arraycopy(a, j + 1, b, j, n - j - 1);
            }
            if (subscribers.compareAndSet(a, b)) {
                return;

            

Reported by PMD.

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

Line: 259

                  @Override
    @CheckReturnValue
    public boolean hasObservers() {
        return subscribers.get().length != 0;
    }

    @Override
    @Nullable
    @CheckReturnValue

            

Reported by PMD.

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

Line: 294

              
        private static final long serialVersionUID = 3562861878281475070L;
        /** The actual subscriber. */
        final Observer<? super T> downstream;
        /** The subject state. */
        final PublishSubject<T> parent;

        /**
         * Constructs a PublishSubscriber, wraps the actual subscriber and the state.

            

Reported by PMD.

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

Line: 296

                      /** The actual subscriber. */
        final Observer<? super T> downstream;
        /** The subject state. */
        final PublishSubject<T> parent;

        /**
         * Constructs a PublishSubscriber, wraps the actual subscriber and the state.
         * @param actual the actual subscriber
         * @param parent the parent PublishProcessor

            

Reported by PMD.