The following issues were found
src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeJustTest.java
6 issues
Line: 27
@SuppressWarnings("unchecked")
@Test
public void scalarSupplier() {
Maybe<Integer> m = Maybe.just(1);
assertTrue(m.getClass().toString(), m instanceof ScalarSupplier);
assertEquals(1, ((ScalarSupplier<Integer>)m).get().intValue());
Reported by PMD.
Line: 30
public void scalarSupplier() {
Maybe<Integer> m = Maybe.just(1);
assertTrue(m.getClass().toString(), m instanceof ScalarSupplier);
assertEquals(1, ((ScalarSupplier<Integer>)m).get().intValue());
}
}
Reported by PMD.
Line: 30
public void scalarSupplier() {
Maybe<Integer> m = Maybe.just(1);
assertTrue(m.getClass().toString(), m instanceof ScalarSupplier);
assertEquals(1, ((ScalarSupplier<Integer>)m).get().intValue());
}
}
Reported by PMD.
Line: 32
assertTrue(m.getClass().toString(), m instanceof ScalarSupplier);
assertEquals(1, ((ScalarSupplier<Integer>)m).get().intValue());
}
}
Reported by PMD.
Line: 16
package io.reactivex.rxjava3.internal.operators.maybe;
import static org.junit.Assert.*;
import org.junit.Test;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.internal.fuseable.ScalarSupplier;
Reported by PMD.
Line: 20
import org.junit.Test;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.internal.fuseable.ScalarSupplier;
public class MaybeJustTest extends RxJavaTest {
@SuppressWarnings("unchecked")
Reported by PMD.
src/main/java/io/reactivex/rxjava3/schedulers/Timed.java
6 issues
Line: 27
* @param <T> the value type
*/
public final class Timed<T> {
final T value;
final long time;
final TimeUnit unit;
/**
* Constructs a {@code Timed} instance with the given value and time information.
Reported by PMD.
Line: 27
* @param <T> the value type
*/
public final class Timed<T> {
final T value;
final long time;
final TimeUnit unit;
/**
* Constructs a {@code Timed} instance with the given value and time information.
Reported by PMD.
Line: 28
*/
public final class Timed<T> {
final T value;
final long time;
final TimeUnit unit;
/**
* Constructs a {@code Timed} instance with the given value and time information.
* @param value the value to hold
Reported by PMD.
Line: 28
*/
public final class Timed<T> {
final T value;
final long time;
final TimeUnit unit;
/**
* Constructs a {@code Timed} instance with the given value and time information.
* @param value the value to hold
Reported by PMD.
Line: 29
public final class Timed<T> {
final T value;
final long time;
final TimeUnit unit;
/**
* Constructs a {@code Timed} instance with the given value and time information.
* @param value the value to hold
* @param time the time to hold
Reported by PMD.
Line: 29
public final class Timed<T> {
final T value;
final long time;
final TimeUnit unit;
/**
* Constructs a {@code Timed} instance with the given value and time information.
* @param value the value to hold
* @param time the time to hold
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeFilterSingleTest.java
6 issues
Line: 28
public class MaybeFilterSingleTest extends RxJavaTest {
@Test
public void error() {
Single.error(new TestException())
.filter(Functions.alwaysTrue())
.test()
.assertFailure(TestException.class);
}
Reported by PMD.
Line: 36
}
@Test
public void dispose() {
TestHelper.checkDisposed(PublishSubject.create().singleOrError().filter(Functions.alwaysTrue()));
}
@Test
public void doubleOnSubscribe() {
Reported by PMD.
Line: 37
@Test
public void dispose() {
TestHelper.checkDisposed(PublishSubject.create().singleOrError().filter(Functions.alwaysTrue()));
}
@Test
public void doubleOnSubscribe() {
TestHelper.checkDoubleOnSubscribeSingleToMaybe(new Function<Single<Object>, MaybeSource<Object>>() {
Reported by PMD.
Line: 37
@Test
public void dispose() {
TestHelper.checkDisposed(PublishSubject.create().singleOrError().filter(Functions.alwaysTrue()));
}
@Test
public void doubleOnSubscribe() {
TestHelper.checkDoubleOnSubscribeSingleToMaybe(new Function<Single<Object>, MaybeSource<Object>>() {
Reported by PMD.
Line: 41
}
@Test
public void doubleOnSubscribe() {
TestHelper.checkDoubleOnSubscribeSingleToMaybe(new Function<Single<Object>, MaybeSource<Object>>() {
@Override
public MaybeSource<Object> apply(Single<Object> v) throws Exception {
return v.filter(Functions.alwaysTrue());
}
Reported by PMD.
Line: 18
import org.junit.Test;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.functions.Function;
import io.reactivex.rxjava3.internal.functions.Functions;
import io.reactivex.rxjava3.subjects.PublishSubject;
import io.reactivex.rxjava3.testsupport.TestHelper;
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/SubscribeWithTest.java
6 issues
Line: 28
public class SubscribeWithTest extends RxJavaTest {
@Test
public void withFlowable() {
Flowable.range(1, 10)
.subscribeWith(new TestSubscriber<>())
.assertResult(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}
Reported by PMD.
Line: 35
}
@Test
public void withObservable() {
Observable.range(1, 10)
.subscribeWith(new TestObserver<>())
.assertResult(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}
Reported by PMD.
Line: 42
}
class ObserverImpl implements SingleObserver<Object>, CompletableObserver {
Object value;
@Override
public void onSubscribe(Disposable d) {
}
Reported by PMD.
Line: 67
@Test
public void withSingle() {
assertEquals(1, Single.just(1).subscribeWith(new ObserverImpl()).value);
}
@Test
public void withCompletable() {
assertEquals(100, Completable.complete().subscribeWith(new ObserverImpl()).value);
Reported by PMD.
Line: 72
@Test
public void withCompletable() {
assertEquals(100, Completable.complete().subscribeWith(new ObserverImpl()).value);
}
}
Reported by PMD.
Line: 20
import org.junit.Test;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.observers.TestObserver;
import io.reactivex.rxjava3.subscribers.TestSubscriber;
public class SubscribeWithTest extends RxJavaTest {
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/completable/CompletablePeekTest.java
6 issues
Line: 31
public class CompletablePeekTest extends RxJavaTest {
@Test
public void onAfterTerminateCrashes() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
Completable.complete()
.doAfterTerminate(new Action() {
@Override
Reported by PMD.
Line: 51
}
@Test
public void disposed() {
TestHelper.checkDisposed(CompletableSubject.create().doOnComplete(Functions.EMPTY_ACTION));
}
}
Reported by PMD.
Line: 52
@Test
public void disposed() {
TestHelper.checkDisposed(CompletableSubject.create().doOnComplete(Functions.EMPTY_ACTION));
}
}
Reported by PMD.
Line: 20
import org.junit.Test;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.functions.Action;
import io.reactivex.rxjava3.internal.functions.Functions;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;
import io.reactivex.rxjava3.subjects.CompletableSubject;
Reported by PMD.
Line: 32
@Test
public void onAfterTerminateCrashes() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
Completable.complete()
.doAfterTerminate(new Action() {
@Override
public void run() throws Exception {
Reported by PMD.
Line: 32
@Test
public void onAfterTerminateCrashes() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
Completable.complete()
.doAfterTerminate(new Action() {
@Override
public void run() throws Exception {
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleHideTest.java
6 issues
Line: 27
public class SingleHideTest extends RxJavaTest {
@Test
public void error() {
Single.error(new TestException())
.hide()
.test()
.assertFailure(TestException.class);
}
Reported by PMD.
Line: 35
}
@Test
public void dispose() {
TestHelper.checkDisposed(PublishSubject.create().singleOrError().hide());
}
@Test
public void doubleOnSubscribe() {
Reported by PMD.
Line: 36
@Test
public void dispose() {
TestHelper.checkDisposed(PublishSubject.create().singleOrError().hide());
}
@Test
public void doubleOnSubscribe() {
TestHelper.checkDoubleOnSubscribeSingle(new Function<Single<Object>, SingleSource<Object>>() {
Reported by PMD.
Line: 36
@Test
public void dispose() {
TestHelper.checkDisposed(PublishSubject.create().singleOrError().hide());
}
@Test
public void doubleOnSubscribe() {
TestHelper.checkDoubleOnSubscribeSingle(new Function<Single<Object>, SingleSource<Object>>() {
Reported by PMD.
Line: 40
}
@Test
public void doubleOnSubscribe() {
TestHelper.checkDoubleOnSubscribeSingle(new Function<Single<Object>, SingleSource<Object>>() {
@Override
public SingleSource<Object> apply(Single<Object> s) throws Exception {
return s.hide();
}
Reported by PMD.
Line: 18
import org.junit.Test;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.functions.Function;
import io.reactivex.rxjava3.subjects.PublishSubject;
import io.reactivex.rxjava3.testsupport.TestHelper;
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableLiftTest.java
6 issues
Line: 43
})
.test();
fail("Should have thrown");
} catch (NullPointerException ex) {
assertTrue(ex.toString(), ex.getCause() instanceof TestException);
TestHelper.assertUndeliverable(errors, 0, TestException.class);
} finally {
RxJavaPlugins.reset();
}
Reported by PMD.
Line: 43
})
.test();
fail("Should have thrown");
} catch (NullPointerException ex) {
assertTrue(ex.toString(), ex.getCause() instanceof TestException);
TestHelper.assertUndeliverable(errors, 0, TestException.class);
} finally {
RxJavaPlugins.reset();
}
Reported by PMD.
Line: 16
package io.reactivex.rxjava3.internal.operators.flowable;
import static org.junit.Assert.*;
import java.util.List;
import org.junit.Test;
import org.reactivestreams.Subscriber;
Reported by PMD.
Line: 23
import org.junit.Test;
import org.reactivestreams.Subscriber;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;
import io.reactivex.rxjava3.testsupport.TestHelper;
public class FlowableLiftTest extends RxJavaTest {
Reported by PMD.
Line: 32
@Test
public void callbackCrash() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
Flowable.just(1)
.lift(new FlowableOperator<Object, Integer>() {
@Override
public Subscriber<? super Integer> apply(Subscriber<? super Object> subscriber) throws Exception {
Reported by PMD.
Line: 32
@Test
public void callbackCrash() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
Flowable.just(1)
.lift(new FlowableOperator<Object, Integer>() {
@Override
public Subscriber<? super Integer> apply(Subscriber<? super Object> subscriber) throws Exception {
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/observable/Burst.java
6 issues
Line: 30
*/
public final class Burst<T> extends Observable<T> {
final List<T> items;
final Throwable error;
Burst(Throwable error, List<T> items) {
this.error = error;
this.items = items;
Reported by PMD.
Line: 30
*/
public final class Burst<T> extends Observable<T> {
final List<T> items;
final Throwable error;
Burst(Throwable error, List<T> items) {
this.error = error;
this.items = items;
Reported by PMD.
Line: 31
public final class Burst<T> extends Observable<T> {
final List<T> items;
final Throwable error;
Burst(Throwable error, List<T> items) {
this.error = error;
this.items = items;
}
Reported by PMD.
Line: 62
public static final class Builder<T> {
private final List<T> items;
private Throwable error;
Builder(List<T> items) {
this.items = items;
}
Reported by PMD.
Line: 63
public static final class Builder<T> {
private final List<T> items;
private Throwable error;
Builder(List<T> items) {
this.items = items;
}
Reported by PMD.
Line: 63
public static final class Builder<T> {
private final List<T> items;
private Throwable error;
Builder(List<T> items) {
this.items = items;
}
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/observers/FutureMultiObserverTest.java
6 issues
Line: 25
public class FutureMultiObserverTest extends RxJavaTest {
@Test
public void cancelBeforeOnSubscribe() {
FutureMultiObserver<Integer> f = new FutureMultiObserver<>();
assertTrue(f.cancel(true));
Disposable d = Disposable.empty();
Reported by PMD.
Line: 28
public void cancelBeforeOnSubscribe() {
FutureMultiObserver<Integer> f = new FutureMultiObserver<>();
assertTrue(f.cancel(true));
Disposable d = Disposable.empty();
f.onSubscribe(d);
Reported by PMD.
Line: 34
f.onSubscribe(d);
assertTrue(d.isDisposed());
}
@Test
public void onCompleteJustAfterDispose() {
FutureMultiObserver<Integer> f = new FutureMultiObserver<>();
Reported by PMD.
Line: 34
f.onSubscribe(d);
assertTrue(d.isDisposed());
}
@Test
public void onCompleteJustAfterDispose() {
FutureMultiObserver<Integer> f = new FutureMultiObserver<>();
Reported by PMD.
Line: 42
FutureMultiObserver<Integer> f = new FutureMultiObserver<>();
Disposable d = Disposable.empty();
f.onSubscribe(d);
assertTrue(f.cancel(true));
f.onComplete();
}
}
Reported by PMD.
Line: 16
package io.reactivex.rxjava3.internal.observers;
import static org.junit.Assert.*;
import org.junit.Test;
import io.reactivex.rxjava3.core.RxJavaTest;
import io.reactivex.rxjava3.disposables.Disposable;
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableForEachTest.java
6 issues
Line: 47
}
});
assertEquals(Arrays.asList(1, 2, 3), list);
}
@Test
public void forEachWileWithError() {
final List<Object> list = new ArrayList<>();
Reported by PMD.
Line: 73
}
});
assertEquals(Arrays.asList(1, 2, 3, 4, 5, 100), list);
}
@Test
public void dispose() {
TestHelper.checkDisposed(
Reported by PMD.
Line: 77
}
@Test
public void dispose() {
TestHelper.checkDisposed(
Flowable.never()
.forEachWhile(v -> true)
);
}
Reported by PMD.
Line: 79
@Test
public void dispose() {
TestHelper.checkDisposed(
Flowable.never()
.forEachWhile(v -> true)
);
}
}
Reported by PMD.
Line: 22
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 FlowableForEachTest extends RxJavaTest {
Reported by PMD.
Line: 24
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.exceptions.TestException;
import io.reactivex.rxjava3.functions.*;
import io.reactivex.rxjava3.testsupport.TestHelper;
public class FlowableForEachTest extends RxJavaTest {
@Test
Reported by PMD.