The following issues were found
src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableTimeoutTests.java
134 issues
Line: 37
import io.reactivex.rxjava3.subscribers.TestSubscriber;
import io.reactivex.rxjava3.testsupport.*;
public class FlowableTimeoutTests extends RxJavaTest {
private PublishProcessor<String> underlyingSubject;
private TestScheduler testScheduler;
private Flowable<String> withTimeout;
private static final long TIMEOUT = 3;
private static final TimeUnit TIME_UNIT = TimeUnit.SECONDS;
Reported by PMD.
Line: 38
import io.reactivex.rxjava3.testsupport.*;
public class FlowableTimeoutTests extends RxJavaTest {
private PublishProcessor<String> underlyingSubject;
private TestScheduler testScheduler;
private Flowable<String> withTimeout;
private static final long TIMEOUT = 3;
private static final TimeUnit TIME_UNIT = TimeUnit.SECONDS;
Reported by PMD.
Line: 39
public class FlowableTimeoutTests extends RxJavaTest {
private PublishProcessor<String> underlyingSubject;
private TestScheduler testScheduler;
private Flowable<String> withTimeout;
private static final long TIMEOUT = 3;
private static final TimeUnit TIME_UNIT = TimeUnit.SECONDS;
@Before
Reported by PMD.
Line: 40
public class FlowableTimeoutTests extends RxJavaTest {
private PublishProcessor<String> underlyingSubject;
private TestScheduler testScheduler;
private Flowable<String> withTimeout;
private static final long TIMEOUT = 3;
private static final TimeUnit TIME_UNIT = TimeUnit.SECONDS;
@Before
public void setUp() {
Reported by PMD.
Line: 60
withTimeout.subscribe(ts);
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
underlyingSubject.onNext("One");
verify(subscriber).onNext("One");
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
verify(subscriber, never()).onError(any(Throwable.class));
ts.cancel();
}
Reported by PMD.
Line: 61
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
underlyingSubject.onNext("One");
verify(subscriber).onNext("One");
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
verify(subscriber, never()).onError(any(Throwable.class));
ts.cancel();
}
Reported by PMD.
Line: 63
underlyingSubject.onNext("One");
verify(subscriber).onNext("One");
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
verify(subscriber, never()).onError(any(Throwable.class));
ts.cancel();
}
@Test
public void shouldNotTimeoutIfSecondOnNextWithinTimeout() {
Reported by PMD.
Line: 77
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
underlyingSubject.onNext("One");
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
underlyingSubject.onNext("Two");
verify(subscriber).onNext("Two");
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
verify(subscriber, never()).onError(any(Throwable.class));
ts.cancel();
}
Reported by PMD.
Line: 78
underlyingSubject.onNext("One");
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
underlyingSubject.onNext("Two");
verify(subscriber).onNext("Two");
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
verify(subscriber, never()).onError(any(Throwable.class));
ts.cancel();
}
Reported by PMD.
Line: 80
underlyingSubject.onNext("Two");
verify(subscriber).onNext("Two");
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
verify(subscriber, never()).onError(any(Throwable.class));
ts.cancel();
}
@Test
public void shouldTimeoutIfOnNextNotWithinTimeout() {
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableDoFinallyTest.java
134 issues
Line: 363
try {
assertEquals(1, qd.poll().intValue());
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
assertFalse(qd.isEmpty());
qd.clear();
Reported by PMD.
Line: 412
try {
assertEquals(1, qd.poll().intValue());
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
assertFalse(qd.isEmpty());
qd.clear();
Reported by PMD.
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.*;
import java.util.*;
Reported by PMD.
Line: 34
import io.reactivex.rxjava3.subjects.UnicastSubject;
import io.reactivex.rxjava3.testsupport.*;
public class ObservableDoFinallyTest extends RxJavaTest implements Action {
int calls;
@Override
public void run() throws Exception {
Reported by PMD.
Line: 36
public class ObservableDoFinallyTest extends RxJavaTest implements Action {
int calls;
@Override
public void run() throws Exception {
calls++;
}
Reported by PMD.
Line: 45
@Test
public void normalJust() {
Observable.just(1)
.doFinally(this)
.test()
.assertResult(1);
assertEquals(1, calls);
Reported by PMD.
Line: 45
@Test
public void normalJust() {
Observable.just(1)
.doFinally(this)
.test()
.assertResult(1);
assertEquals(1, calls);
Reported by PMD.
Line: 45
@Test
public void normalJust() {
Observable.just(1)
.doFinally(this)
.test()
.assertResult(1);
assertEquals(1, calls);
Reported by PMD.
Line: 50
.test()
.assertResult(1);
assertEquals(1, calls);
}
@Test
public void normalEmpty() {
Observable.empty()
Reported by PMD.
Line: 55
@Test
public void normalEmpty() {
Observable.empty()
.doFinally(this)
.test()
.assertResult();
assertEquals(1, calls);
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCreateTest.java
134 issues
Line: 127
Observable.<Integer>create(new ObservableOnSubscribe<Integer>() {
@Override
public void subscribe(ObservableEmitter<Integer> e) throws Exception {
e = e.serialize();
e.setDisposable(d);
e.onNext(1);
Reported by PMD.
Line: 155
Observable.<Integer>create(new ObservableOnSubscribe<Integer>() {
@Override
public void subscribe(ObservableEmitter<Integer> e) throws Exception {
e = e.serialize();
e.setDisposable(d);
e.onNext(1);
Reported by PMD.
Line: 247
Observable.create(new ObservableOnSubscribe<Integer>() {
@Override
public void subscribe(ObservableEmitter<Integer> e) throws Exception {
e = e.serialize();
try {
e.onNext(null);
e.onNext(1);
e.onError(new TestException());
Reported by PMD.
Line: 639
final Boolean[] response = { null };
Observable.create(new ObservableOnSubscribe<Object>() {
@Override
public void subscribe(ObservableEmitter<Object> e) throws Exception {
e = e.serialize();
e.onNext(1);
response[0] = e.tryOnError(new TestException());
}
})
Reported by PMD.
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.*;
import java.io.IOException;
import java.util.List;
Reported by PMD.
Line: 33
import io.reactivex.rxjava3.plugins.RxJavaPlugins;
import io.reactivex.rxjava3.testsupport.*;
public class ObservableCreateTest extends RxJavaTest {
@Test
@SuppressUndeliverable
public void basic() {
final Disposable d = Disposable.empty();
Reported by PMD.
Line: 58
.test()
.assertResult(1, 2, 3);
assertTrue(d.isDisposed());
}
@Test
@SuppressUndeliverable
public void basicWithCancellable() {
Reported by PMD.
Line: 58
.test()
.assertResult(1, 2, 3);
assertTrue(d.isDisposed());
}
@Test
@SuppressUndeliverable
public void basicWithCancellable() {
Reported by PMD.
Line: 63
@Test
@SuppressUndeliverable
public void basicWithCancellable() {
final Disposable d1 = Disposable.empty();
final Disposable d2 = Disposable.empty();
Observable.<Integer>create(new ObservableOnSubscribe<Integer>() {
@Override
Reported by PMD.
Line: 91
.test()
.assertResult(1, 2, 3);
assertTrue(d1.isDisposed());
assertTrue(d2.isDisposed());
}
@Test
@SuppressUndeliverable
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/single/SingleAmbTest.java
134 issues
Line: 34
import io.reactivex.rxjava3.subjects.*;
import io.reactivex.rxjava3.testsupport.TestHelper;
public class SingleAmbTest extends RxJavaTest {
@Test
public void ambWithFirstFires() {
PublishProcessor<Integer> pp1 = PublishProcessor.create();
PublishProcessor<Integer> pp2 = PublishProcessor.create();
Reported by PMD.
Line: 36
public class SingleAmbTest extends RxJavaTest {
@Test
public void ambWithFirstFires() {
PublishProcessor<Integer> pp1 = PublishProcessor.create();
PublishProcessor<Integer> pp2 = PublishProcessor.create();
TestObserver<Integer> to = pp1.single(-99).ambWith(pp2.single(-99)).test();
Reported by PMD.
Line: 40
PublishProcessor<Integer> pp1 = PublishProcessor.create();
PublishProcessor<Integer> pp2 = PublishProcessor.create();
TestObserver<Integer> to = pp1.single(-99).ambWith(pp2.single(-99)).test();
assertTrue(pp1.hasSubscribers());
assertTrue(pp2.hasSubscribers());
pp1.onNext(1);
Reported by PMD.
Line: 40
PublishProcessor<Integer> pp1 = PublishProcessor.create();
PublishProcessor<Integer> pp2 = PublishProcessor.create();
TestObserver<Integer> to = pp1.single(-99).ambWith(pp2.single(-99)).test();
assertTrue(pp1.hasSubscribers());
assertTrue(pp2.hasSubscribers());
pp1.onNext(1);
Reported by PMD.
Line: 40
PublishProcessor<Integer> pp1 = PublishProcessor.create();
PublishProcessor<Integer> pp2 = PublishProcessor.create();
TestObserver<Integer> to = pp1.single(-99).ambWith(pp2.single(-99)).test();
assertTrue(pp1.hasSubscribers());
assertTrue(pp2.hasSubscribers());
pp1.onNext(1);
Reported by PMD.
Line: 40
PublishProcessor<Integer> pp1 = PublishProcessor.create();
PublishProcessor<Integer> pp2 = PublishProcessor.create();
TestObserver<Integer> to = pp1.single(-99).ambWith(pp2.single(-99)).test();
assertTrue(pp1.hasSubscribers());
assertTrue(pp2.hasSubscribers());
pp1.onNext(1);
Reported by PMD.
Line: 42
TestObserver<Integer> to = pp1.single(-99).ambWith(pp2.single(-99)).test();
assertTrue(pp1.hasSubscribers());
assertTrue(pp2.hasSubscribers());
pp1.onNext(1);
pp1.onComplete();
Reported by PMD.
Line: 42
TestObserver<Integer> to = pp1.single(-99).ambWith(pp2.single(-99)).test();
assertTrue(pp1.hasSubscribers());
assertTrue(pp2.hasSubscribers());
pp1.onNext(1);
pp1.onComplete();
Reported by PMD.
Line: 43
TestObserver<Integer> to = pp1.single(-99).ambWith(pp2.single(-99)).test();
assertTrue(pp1.hasSubscribers());
assertTrue(pp2.hasSubscribers());
pp1.onNext(1);
pp1.onComplete();
assertFalse(pp1.hasSubscribers());
Reported by PMD.
Line: 43
TestObserver<Integer> to = pp1.single(-99).ambWith(pp2.single(-99)).test();
assertTrue(pp1.hasSubscribers());
assertTrue(pp2.hasSubscribers());
pp1.onNext(1);
pp1.onComplete();
assertFalse(pp1.hasSubscribers());
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableTimeoutTests.java
133 issues
Line: 36
import io.reactivex.rxjava3.subjects.PublishSubject;
import io.reactivex.rxjava3.testsupport.*;
public class ObservableTimeoutTests extends RxJavaTest {
private PublishSubject<String> underlyingSubject;
private TestScheduler testScheduler;
private Observable<String> withTimeout;
private static final long TIMEOUT = 3;
private static final TimeUnit TIME_UNIT = TimeUnit.SECONDS;
Reported by PMD.
Line: 37
import io.reactivex.rxjava3.testsupport.*;
public class ObservableTimeoutTests extends RxJavaTest {
private PublishSubject<String> underlyingSubject;
private TestScheduler testScheduler;
private Observable<String> withTimeout;
private static final long TIMEOUT = 3;
private static final TimeUnit TIME_UNIT = TimeUnit.SECONDS;
Reported by PMD.
Line: 38
public class ObservableTimeoutTests extends RxJavaTest {
private PublishSubject<String> underlyingSubject;
private TestScheduler testScheduler;
private Observable<String> withTimeout;
private static final long TIMEOUT = 3;
private static final TimeUnit TIME_UNIT = TimeUnit.SECONDS;
@Before
Reported by PMD.
Line: 39
public class ObservableTimeoutTests extends RxJavaTest {
private PublishSubject<String> underlyingSubject;
private TestScheduler testScheduler;
private Observable<String> withTimeout;
private static final long TIMEOUT = 3;
private static final TimeUnit TIME_UNIT = TimeUnit.SECONDS;
@Before
public void setUp() {
Reported by PMD.
Line: 59
withTimeout.subscribe(to);
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
underlyingSubject.onNext("One");
verify(observer).onNext("One");
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
verify(observer, never()).onError(any(Throwable.class));
to.dispose();
}
Reported by PMD.
Line: 60
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
underlyingSubject.onNext("One");
verify(observer).onNext("One");
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
verify(observer, never()).onError(any(Throwable.class));
to.dispose();
}
Reported by PMD.
Line: 62
underlyingSubject.onNext("One");
verify(observer).onNext("One");
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
verify(observer, never()).onError(any(Throwable.class));
to.dispose();
}
@Test
public void shouldNotTimeoutIfSecondOnNextWithinTimeout() {
Reported by PMD.
Line: 76
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
underlyingSubject.onNext("One");
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
underlyingSubject.onNext("Two");
verify(observer).onNext("Two");
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
verify(observer, never()).onError(any(Throwable.class));
to.dispose();
}
Reported by PMD.
Line: 77
underlyingSubject.onNext("One");
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
underlyingSubject.onNext("Two");
verify(observer).onNext("Two");
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
verify(observer, never()).onError(any(Throwable.class));
to.dispose();
}
Reported by PMD.
Line: 79
underlyingSubject.onNext("Two");
verify(observer).onNext("Two");
testScheduler.advanceTimeBy(2, TimeUnit.SECONDS);
verify(observer, never()).onError(any(Throwable.class));
to.dispose();
}
@Test
public void shouldTimeoutIfOnNextNotWithinTimeout() {
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableRangeTest.java
133 issues
Line: 220
@Override
public void onError(Throwable e) {
throw new RuntimeException(e);
}
@Override
public void onNext(Integer t) {
count.incrementAndGet();
Reported by PMD.
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.any;
import static org.mockito.Mockito.*;
Reported by PMD.
Line: 33
import io.reactivex.rxjava3.subscribers.*;
import io.reactivex.rxjava3.testsupport.*;
public class FlowableRangeTest extends RxJavaTest {
@Test
public void rangeStartAt2Count3() {
Subscriber<Integer> subscriber = TestHelper.mockSubscriber();
Reported by PMD.
Line: 33
import io.reactivex.rxjava3.subscribers.*;
import io.reactivex.rxjava3.testsupport.*;
public class FlowableRangeTest extends RxJavaTest {
@Test
public void rangeStartAt2Count3() {
Subscriber<Integer> subscriber = TestHelper.mockSubscriber();
Reported by PMD.
Line: 39
public void rangeStartAt2Count3() {
Subscriber<Integer> subscriber = TestHelper.mockSubscriber();
Flowable.range(2, 3).subscribe(subscriber);
verify(subscriber, times(1)).onNext(2);
verify(subscriber, times(1)).onNext(3);
verify(subscriber, times(1)).onNext(4);
verify(subscriber, never()).onNext(5);
Reported by PMD.
Line: 41
Flowable.range(2, 3).subscribe(subscriber);
verify(subscriber, times(1)).onNext(2);
verify(subscriber, times(1)).onNext(3);
verify(subscriber, times(1)).onNext(4);
verify(subscriber, never()).onNext(5);
verify(subscriber, never()).onError(any(Throwable.class));
verify(subscriber, times(1)).onComplete();
Reported by PMD.
Line: 42
Flowable.range(2, 3).subscribe(subscriber);
verify(subscriber, times(1)).onNext(2);
verify(subscriber, times(1)).onNext(3);
verify(subscriber, times(1)).onNext(4);
verify(subscriber, never()).onNext(5);
verify(subscriber, never()).onError(any(Throwable.class));
verify(subscriber, times(1)).onComplete();
}
Reported by PMD.
Line: 43
verify(subscriber, times(1)).onNext(2);
verify(subscriber, times(1)).onNext(3);
verify(subscriber, times(1)).onNext(4);
verify(subscriber, never()).onNext(5);
verify(subscriber, never()).onError(any(Throwable.class));
verify(subscriber, times(1)).onComplete();
}
Reported by PMD.
Line: 44
verify(subscriber, times(1)).onNext(2);
verify(subscriber, times(1)).onNext(3);
verify(subscriber, times(1)).onNext(4);
verify(subscriber, never()).onNext(5);
verify(subscriber, never()).onError(any(Throwable.class));
verify(subscriber, times(1)).onComplete();
}
@Test
Reported by PMD.
Line: 45
verify(subscriber, times(1)).onNext(3);
verify(subscriber, times(1)).onNext(4);
verify(subscriber, never()).onNext(5);
verify(subscriber, never()).onError(any(Throwable.class));
verify(subscriber, times(1)).onComplete();
}
@Test
public void rangeUnsubscribe() {
Reported by PMD.
src/test/java/io/reactivex/rxjava3/flowable/FlowableCollectTest.java
132 issues
Line: 31
import io.reactivex.rxjava3.plugins.RxJavaPlugins;
import io.reactivex.rxjava3.testsupport.TestHelper;
public final class FlowableCollectTest extends RxJavaTest {
@Test
public void collectToListFlowable() {
Flowable<List<Integer>> f = Flowable.just(1, 2, 3)
.collect(new Supplier<List<Integer>>() {
Reported by PMD.
Line: 34
public final class FlowableCollectTest extends RxJavaTest {
@Test
public void collectToListFlowable() {
Flowable<List<Integer>> f = Flowable.just(1, 2, 3)
.collect(new Supplier<List<Integer>>() {
@Override
public List<Integer> get() {
return new ArrayList<>();
Reported by PMD.
Line: 50
List<Integer> list = f.blockingLast();
assertEquals(3, list.size());
assertEquals(1, list.get(0).intValue());
assertEquals(2, list.get(1).intValue());
assertEquals(3, list.get(2).intValue());
// test multiple subscribe
Reported by PMD.
Line: 50
List<Integer> list = f.blockingLast();
assertEquals(3, list.size());
assertEquals(1, list.get(0).intValue());
assertEquals(2, list.get(1).intValue());
assertEquals(3, list.get(2).intValue());
// test multiple subscribe
Reported by PMD.
Line: 51
List<Integer> list = f.blockingLast();
assertEquals(3, list.size());
assertEquals(1, list.get(0).intValue());
assertEquals(2, list.get(1).intValue());
assertEquals(3, list.get(2).intValue());
// test multiple subscribe
List<Integer> list2 = f.blockingLast();
Reported by PMD.
Line: 51
List<Integer> list = f.blockingLast();
assertEquals(3, list.size());
assertEquals(1, list.get(0).intValue());
assertEquals(2, list.get(1).intValue());
assertEquals(3, list.get(2).intValue());
// test multiple subscribe
List<Integer> list2 = f.blockingLast();
Reported by PMD.
Line: 51
List<Integer> list = f.blockingLast();
assertEquals(3, list.size());
assertEquals(1, list.get(0).intValue());
assertEquals(2, list.get(1).intValue());
assertEquals(3, list.get(2).intValue());
// test multiple subscribe
List<Integer> list2 = f.blockingLast();
Reported by PMD.
Line: 52
assertEquals(3, list.size());
assertEquals(1, list.get(0).intValue());
assertEquals(2, list.get(1).intValue());
assertEquals(3, list.get(2).intValue());
// test multiple subscribe
List<Integer> list2 = f.blockingLast();
Reported by PMD.
Line: 52
assertEquals(3, list.size());
assertEquals(1, list.get(0).intValue());
assertEquals(2, list.get(1).intValue());
assertEquals(3, list.get(2).intValue());
// test multiple subscribe
List<Integer> list2 = f.blockingLast();
Reported by PMD.
Line: 52
assertEquals(3, list.size());
assertEquals(1, list.get(0).intValue());
assertEquals(2, list.get(1).intValue());
assertEquals(3, list.get(2).intValue());
// test multiple subscribe
List<Integer> list2 = f.blockingLast();
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCollectTest.java
130 issues
Line: 31
import io.reactivex.rxjava3.plugins.RxJavaPlugins;
import io.reactivex.rxjava3.testsupport.TestHelper;
public final class ObservableCollectTest extends RxJavaTest {
@Test
public void collectToListObservable() {
Observable<List<Integer>> o = Observable.just(1, 2, 3)
.collect(new Supplier<List<Integer>>() {
Reported by PMD.
Line: 34
public final class ObservableCollectTest extends RxJavaTest {
@Test
public void collectToListObservable() {
Observable<List<Integer>> o = Observable.just(1, 2, 3)
.collect(new Supplier<List<Integer>>() {
@Override
public List<Integer> get() {
return new ArrayList<>();
Reported by PMD.
Line: 50
List<Integer> list = o.blockingLast();
assertEquals(3, list.size());
assertEquals(1, list.get(0).intValue());
assertEquals(2, list.get(1).intValue());
assertEquals(3, list.get(2).intValue());
// test multiple subscribe
Reported by PMD.
Line: 50
List<Integer> list = o.blockingLast();
assertEquals(3, list.size());
assertEquals(1, list.get(0).intValue());
assertEquals(2, list.get(1).intValue());
assertEquals(3, list.get(2).intValue());
// test multiple subscribe
Reported by PMD.
Line: 51
List<Integer> list = o.blockingLast();
assertEquals(3, list.size());
assertEquals(1, list.get(0).intValue());
assertEquals(2, list.get(1).intValue());
assertEquals(3, list.get(2).intValue());
// test multiple subscribe
List<Integer> list2 = o.blockingLast();
Reported by PMD.
Line: 51
List<Integer> list = o.blockingLast();
assertEquals(3, list.size());
assertEquals(1, list.get(0).intValue());
assertEquals(2, list.get(1).intValue());
assertEquals(3, list.get(2).intValue());
// test multiple subscribe
List<Integer> list2 = o.blockingLast();
Reported by PMD.
Line: 51
List<Integer> list = o.blockingLast();
assertEquals(3, list.size());
assertEquals(1, list.get(0).intValue());
assertEquals(2, list.get(1).intValue());
assertEquals(3, list.get(2).intValue());
// test multiple subscribe
List<Integer> list2 = o.blockingLast();
Reported by PMD.
Line: 52
assertEquals(3, list.size());
assertEquals(1, list.get(0).intValue());
assertEquals(2, list.get(1).intValue());
assertEquals(3, list.get(2).intValue());
// test multiple subscribe
List<Integer> list2 = o.blockingLast();
Reported by PMD.
Line: 52
assertEquals(3, list.size());
assertEquals(1, list.get(0).intValue());
assertEquals(2, list.get(1).intValue());
assertEquals(3, list.get(2).intValue());
// test multiple subscribe
List<Integer> list2 = o.blockingLast();
Reported by PMD.
Line: 52
assertEquals(3, list.size());
assertEquals(1, list.get(0).intValue());
assertEquals(2, list.get(1).intValue());
assertEquals(3, list.get(2).intValue());
// test multiple subscribe
List<Integer> list2 = o.blockingLast();
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDebounceTest.java
130 issues
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.
Line: 41
import io.reactivex.rxjava3.subscribers.TestSubscriber;
import io.reactivex.rxjava3.testsupport.*;
public class FlowableDebounceTest extends RxJavaTest {
private TestScheduler scheduler;
private Subscriber<String> Subscriber;
private Scheduler.Worker innerScheduler;
Reported by PMD.
Line: 43
public class FlowableDebounceTest extends RxJavaTest {
private TestScheduler scheduler;
private Subscriber<String> Subscriber;
private Scheduler.Worker innerScheduler;
@Before
public void before() {
Reported by PMD.
Line: 44
public class FlowableDebounceTest extends RxJavaTest {
private TestScheduler scheduler;
private Subscriber<String> Subscriber;
private Scheduler.Worker innerScheduler;
@Before
public void before() {
scheduler = new TestScheduler();
Reported by PMD.
Line: 45
private TestScheduler scheduler;
private Subscriber<String> Subscriber;
private Scheduler.Worker innerScheduler;
@Before
public void before() {
scheduler = new TestScheduler();
Subscriber = TestHelper.mockSubscriber();
Reported by PMD.
Line: 68
});
Flowable<String> sampled = source.debounce(400, TimeUnit.MILLISECONDS, scheduler);
sampled.subscribe(Subscriber);
scheduler.advanceTimeTo(0, TimeUnit.MILLISECONDS);
InOrder inOrder = inOrder(Subscriber);
// must go to 800 since it must be 400 after when two is sent, which is at 400
scheduler.advanceTimeTo(800, TimeUnit.MILLISECONDS);
Reported by PMD.
Line: 74
InOrder inOrder = inOrder(Subscriber);
// must go to 800 since it must be 400 after when two is sent, which is at 400
scheduler.advanceTimeTo(800, TimeUnit.MILLISECONDS);
inOrder.verify(Subscriber, times(1)).onNext("two");
scheduler.advanceTimeTo(1000, TimeUnit.MILLISECONDS);
inOrder.verify(Subscriber, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
Reported by PMD.
Line: 74
InOrder inOrder = inOrder(Subscriber);
// must go to 800 since it must be 400 after when two is sent, which is at 400
scheduler.advanceTimeTo(800, TimeUnit.MILLISECONDS);
inOrder.verify(Subscriber, times(1)).onNext("two");
scheduler.advanceTimeTo(1000, TimeUnit.MILLISECONDS);
inOrder.verify(Subscriber, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
Reported by PMD.
Line: 76
scheduler.advanceTimeTo(800, TimeUnit.MILLISECONDS);
inOrder.verify(Subscriber, times(1)).onNext("two");
scheduler.advanceTimeTo(1000, TimeUnit.MILLISECONDS);
inOrder.verify(Subscriber, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
@Test
public void debounceNeverEmits() {
Reported by PMD.
Line: 76
scheduler.advanceTimeTo(800, TimeUnit.MILLISECONDS);
inOrder.verify(Subscriber, times(1)).onNext("two");
scheduler.advanceTimeTo(1000, TimeUnit.MILLISECONDS);
inOrder.verify(Subscriber, times(1)).onComplete();
inOrder.verifyNoMoreInteractions();
}
@Test
public void debounceNeverEmits() {
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableFlatMapCompletableTest.java
130 issues
Line: 429
try {
assertNull(qs.poll());
} catch (Throwable ex) {
throw new RuntimeException(ex);
}
assertTrue(qs.isEmpty());
qs.clear();
}
Reported by PMD.
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 java.util.List;
import java.util.concurrent.*;
Reported by PMD.
Line: 36
import io.reactivex.rxjava3.subscribers.TestSubscriber;
import io.reactivex.rxjava3.testsupport.*;
public class FlowableFlatMapCompletableTest extends RxJavaTest {
@Test
public void normalFlowable() {
Flowable.range(1, 10)
.flatMapCompletable(new Function<Integer, CompletableSource>() {
Reported by PMD.
Line: 39
public class FlowableFlatMapCompletableTest extends RxJavaTest {
@Test
public void normalFlowable() {
Flowable.range(1, 10)
.flatMapCompletable(new Function<Integer, CompletableSource>() {
@Override
public CompletableSource apply(Integer v) throws Exception {
return Completable.complete();
Reported by PMD.
Line: 52
}
@Test
public void mapperThrowsFlowable() {
PublishProcessor<Integer> pp = PublishProcessor.create();
TestSubscriber<Integer> ts = pp
.flatMapCompletable(new Function<Integer, CompletableSource>() {
@Override
Reported by PMD.
Line: 64
}).<Integer>toFlowable()
.test();
assertTrue(pp.hasSubscribers());
pp.onNext(1);
ts.assertFailure(TestException.class);
Reported by PMD.
Line: 64
}).<Integer>toFlowable()
.test();
assertTrue(pp.hasSubscribers());
pp.onNext(1);
ts.assertFailure(TestException.class);
Reported by PMD.
Line: 66
assertTrue(pp.hasSubscribers());
pp.onNext(1);
ts.assertFailure(TestException.class);
assertFalse(pp.hasSubscribers());
}
Reported by PMD.
Line: 70
ts.assertFailure(TestException.class);
assertFalse(pp.hasSubscribers());
}
@Test
public void mapperReturnsNullFlowable() {
PublishProcessor<Integer> pp = PublishProcessor.create();
Reported by PMD.
Line: 70
ts.assertFailure(TestException.class);
assertFalse(pp.hasSubscribers());
}
@Test
public void mapperReturnsNullFlowable() {
PublishProcessor<Integer> pp = PublishProcessor.create();
Reported by PMD.