The following issues were found
src/test/java/io/reactivex/rxjava3/internal/disposables/ListCompositeDisposableTest.java
91 issues
Line: 27
import io.reactivex.rxjava3.exceptions.*;
import io.reactivex.rxjava3.testsupport.TestHelper;
public class ListCompositeDisposableTest extends RxJavaTest {
@Test
public void constructorAndAddVarargs() {
Disposable d1 = Disposable.empty();
Disposable d2 = Disposable.empty();
Reported by PMD.
Line: 30
public class ListCompositeDisposableTest extends RxJavaTest {
@Test
public void constructorAndAddVarargs() {
Disposable d1 = Disposable.empty();
Disposable d2 = Disposable.empty();
ListCompositeDisposable lcd = new ListCompositeDisposable(d1, d2);
Reported by PMD.
Line: 38
lcd.clear();
assertFalse(lcd.isDisposed());
assertTrue(d1.isDisposed());
assertTrue(d2.isDisposed());
d1 = Disposable.empty();
Reported by PMD.
Line: 40
assertFalse(lcd.isDisposed());
assertTrue(d1.isDisposed());
assertTrue(d2.isDisposed());
d1 = Disposable.empty();
d2 = Disposable.empty();
Reported by PMD.
Line: 40
assertFalse(lcd.isDisposed());
assertTrue(d1.isDisposed());
assertTrue(d2.isDisposed());
d1 = Disposable.empty();
d2 = Disposable.empty();
Reported by PMD.
Line: 41
assertFalse(lcd.isDisposed());
assertTrue(d1.isDisposed());
assertTrue(d2.isDisposed());
d1 = Disposable.empty();
d2 = Disposable.empty();
lcd.addAll(d1, d2);
Reported by PMD.
Line: 41
assertFalse(lcd.isDisposed());
assertTrue(d1.isDisposed());
assertTrue(d2.isDisposed());
d1 = Disposable.empty();
d2 = Disposable.empty();
lcd.addAll(d1, d2);
Reported by PMD.
Line: 50
lcd.dispose();
assertTrue(lcd.isDisposed());
assertTrue(d1.isDisposed());
assertTrue(d2.isDisposed());
}
@Test
Reported by PMD.
Line: 51
lcd.dispose();
assertTrue(lcd.isDisposed());
assertTrue(d1.isDisposed());
assertTrue(d2.isDisposed());
}
@Test
public void constructorIterable() {
Reported by PMD.
Line: 51
lcd.dispose();
assertTrue(lcd.isDisposed());
assertTrue(d1.isDisposed());
assertTrue(d2.isDisposed());
}
@Test
public void constructorIterable() {
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableDistinctUntilChangedTest.java
90 issues
Line: 185
private static final Function<String, String> THROWS_NON_FATAL = new Function<String, String>() {
@Override
public String apply(String s) {
throw new RuntimeException();
}
};
@Test
public void distinctUntilChangedWhenNonFatalExceptionThrownByKeySelectorIsNotReportedByUpstream() {
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.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import java.io.IOException;
Reported by PMD.
Line: 38
import io.reactivex.rxjava3.subscribers.TestSubscriber;
import io.reactivex.rxjava3.testsupport.*;
public class FlowableDistinctUntilChangedTest extends RxJavaTest {
Subscriber<String> w;
Subscriber<String> w2;
// nulls lead to exceptions
Reported by PMD.
Line: 40
public class FlowableDistinctUntilChangedTest extends RxJavaTest {
Subscriber<String> w;
Subscriber<String> w2;
// nulls lead to exceptions
final Function<String, String> TO_UPPER_WITH_EXCEPTION = new Function<String, String>() {
@Override
Reported by PMD.
Line: 41
public class FlowableDistinctUntilChangedTest extends RxJavaTest {
Subscriber<String> w;
Subscriber<String> w2;
// nulls lead to exceptions
final Function<String, String> TO_UPPER_WITH_EXCEPTION = new Function<String, String>() {
@Override
public String apply(String s) {
Reported by PMD.
Line: 44
Subscriber<String> w2;
// nulls lead to exceptions
final Function<String, String> TO_UPPER_WITH_EXCEPTION = new Function<String, String>() {
@Override
public String apply(String s) {
if (s.equals("x")) {
return "xx";
}
Reported by PMD.
Line: 47
final Function<String, String> TO_UPPER_WITH_EXCEPTION = new Function<String, String>() {
@Override
public String apply(String s) {
if (s.equals("x")) {
return "xx";
}
return s.toUpperCase();
}
};
Reported by PMD.
Line: 47
final Function<String, String> TO_UPPER_WITH_EXCEPTION = new Function<String, String>() {
@Override
public String apply(String s) {
if (s.equals("x")) {
return "xx";
}
return s.toUpperCase();
}
};
Reported by PMD.
Line: 50
if (s.equals("x")) {
return "xx";
}
return s.toUpperCase();
}
};
@Before
public void before() {
Reported by PMD.
Line: 63
@Test
public void distinctUntilChangedOfNone() {
Flowable<String> src = Flowable.empty();
src.distinctUntilChanged().subscribe(w);
verify(w, never()).onNext(anyString());
verify(w, never()).onError(any(Throwable.class));
verify(w, times(1)).onComplete();
}
Reported by PMD.
src/test/java/io/reactivex/rxjava3/validators/BaseTypeAnnotations.java
90 issues
Line: 79
}
if (b.length() != 0) {
System.out.println(clazz);
System.out.println("------------------------");
System.out.println(b);
fail(b.toString());
}
Reported by PMD.
Line: 80
if (b.length() != 0) {
System.out.println(clazz);
System.out.println("------------------------");
System.out.println(b);
fail(b.toString());
}
}
Reported by PMD.
Line: 81
if (b.length() != 0) {
System.out.println(clazz);
System.out.println("------------------------");
System.out.println(b);
fail(b.toString());
}
}
Reported by PMD.
Line: 127
}
if (b.length() != 0) {
System.out.println(clazz);
System.out.println("------------------------");
System.out.println(b);
fail(b.toString());
}
Reported by PMD.
Line: 128
if (b.length() != 0) {
System.out.println(clazz);
System.out.println("------------------------");
System.out.println(b);
fail(b.toString());
}
}
Reported by PMD.
Line: 129
if (b.length() != 0) {
System.out.println(clazz);
System.out.println("------------------------");
System.out.println(b);
fail(b.toString());
}
}
Reported by PMD.
Line: 182
}
if (b.length() != 0) {
System.out.println(clazz);
System.out.println("------------------------");
System.out.println(b);
fail(b.toString());
}
Reported by PMD.
Line: 183
if (b.length() != 0) {
System.out.println(clazz);
System.out.println("------------------------");
System.out.println(b);
fail(b.toString());
}
}
Reported by PMD.
Line: 184
if (b.length() != 0) {
System.out.println(clazz);
System.out.println("------------------------");
System.out.println(b);
fail(b.toString());
}
}
Reported by PMD.
Line: 14
* the License for the specific language governing permissions and limitations under the License.
*/
package io.reactivex.rxjava3.validators;
import static org.junit.Assert.fail;
import java.lang.reflect.*;
Reported by PMD.
src/test/java/io/reactivex/rxjava3/observers/ResourceMaybeObserverTest.java
90 issues
Line: 31
public class ResourceMaybeObserverTest extends RxJavaTest {
static final class TestResourceMaybeObserver<T> extends ResourceMaybeObserver<T> {
T value;
final List<Throwable> errors = new ArrayList<>();
int complete;
Reported by PMD.
Line: 33
static final class TestResourceMaybeObserver<T> extends ResourceMaybeObserver<T> {
T value;
final List<Throwable> errors = new ArrayList<>();
int complete;
int start;
Reported by PMD.
Line: 35
final List<Throwable> errors = new ArrayList<>();
int complete;
int start;
@Override
protected void onStart() {
Reported by PMD.
Line: 37
int complete;
int start;
@Override
protected void onStart() {
super.onStart();
Reported by PMD.
Line: 75
}
@Test
public void addResources() {
TestResourceMaybeObserver<Integer> rmo = new TestResourceMaybeObserver<>();
assertFalse(rmo.isDisposed());
Disposable d = Disposable.empty();
Reported by PMD.
Line: 78
public void addResources() {
TestResourceMaybeObserver<Integer> rmo = new TestResourceMaybeObserver<>();
assertFalse(rmo.isDisposed());
Disposable d = Disposable.empty();
rmo.add(d);
Reported by PMD.
Line: 84
rmo.add(d);
assertFalse(d.isDisposed());
rmo.dispose();
assertTrue(rmo.isDisposed());
Reported by PMD.
Line: 84
rmo.add(d);
assertFalse(d.isDisposed());
rmo.dispose();
assertTrue(rmo.isDisposed());
Reported by PMD.
Line: 88
rmo.dispose();
assertTrue(rmo.isDisposed());
assertTrue(d.isDisposed());
rmo.dispose();
Reported by PMD.
Line: 90
assertTrue(rmo.isDisposed());
assertTrue(d.isDisposed());
rmo.dispose();
assertTrue(rmo.isDisposed());
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableOnErrorResumeNextViaFunctionTest.java
90 issues
Line: 127
@Override
public Flowable<String> apply(Throwable t1) {
throw new RuntimeException("exception from function");
}
};
Flowable<String> flowable = Flowable.unsafeCreate(w).onErrorResumeNext(resume);
Reported by PMD.
Line: 161
@Override
public String apply(String s) {
if ("fail".equals(s)) {
throw new RuntimeException("Forced Failure");
}
System.out.println("BadMapper:" + s);
return s;
}
});
Reported by PMD.
Line: 215
System.out.println("TestFlowable onNext: " + s);
subscriber.onNext(s);
}
throw new RuntimeException("Forced Failure");
} catch (Throwable e) {
subscriber.onError(e);
}
}
Reported by PMD.
Line: 163
if ("fail".equals(s)) {
throw new RuntimeException("Forced Failure");
}
System.out.println("BadMapper:" + s);
return s;
}
});
Flowable<String> flowable = w.onErrorResumeNext(new Function<Throwable, Flowable<String>>() {
Reported by PMD.
Line: 203
@Override
public void subscribe(final Subscriber<? super String> subscriber) {
System.out.println("TestFlowable subscribed to ...");
subscriber.onSubscribe(new BooleanSubscription());
t = new Thread(new Runnable() {
@Override
public void run() {
Reported by PMD.
Line: 210
@Override
public void run() {
try {
System.out.println("running TestFlowable thread");
for (String s : values) {
System.out.println("TestFlowable onNext: " + s);
subscriber.onNext(s);
}
throw new RuntimeException("Forced Failure");
Reported by PMD.
Line: 212
try {
System.out.println("running TestFlowable thread");
for (String s : values) {
System.out.println("TestFlowable onNext: " + s);
subscriber.onNext(s);
}
throw new RuntimeException("Forced Failure");
} catch (Throwable e) {
subscriber.onError(e);
Reported by PMD.
Line: 222
}
});
System.out.println("starting TestFlowable thread");
t.start();
System.out.println("done starting TestFlowable thread");
}
}
Reported by PMD.
Line: 224
});
System.out.println("starting TestFlowable thread");
t.start();
System.out.println("done starting TestFlowable thread");
}
}
@Test
Reported by PMD.
Line: 48
@Override
public void subscribe(Subscriber<? super String> subscriber) {
subscriber.onSubscribe(new BooleanSubscription());
subscriber.onNext("one");
subscriber.onError(new Throwable("injected failure"));
subscriber.onNext("two");
subscriber.onNext("three");
}
});
Reported by PMD.
src/main/java/io/reactivex/rxjava3/core/Single.java
90 issues
Line: 4862
Exceptions.throwIfFatal(ex);
NullPointerException npe = new NullPointerException("subscribeActual failed");
npe.initCause(ex);
throw npe;
}
}
/**
* Implement this method in subclasses to handle the incoming {@link SingleObserver}s.
Reported by PMD.
Line: 4847
@SchedulerSupport(SchedulerSupport.NONE)
@Override
public final void subscribe(@NonNull SingleObserver<? super T> observer) {
Objects.requireNonNull(observer, "observer is null");
observer = RxJavaPlugins.onSubscribe(this, observer);
Objects.requireNonNull(observer, "The RxJavaPlugins.onSubscribe hook returned a null SingleObserver. Please check the handler provided to RxJavaPlugins.setOnSingleSubscribe for invalid null returns. Further reading: https://github.com/ReactiveX/RxJava/wiki/Plugins");
Reported by PMD.
Line: 14
* the License for the specific language governing permissions and limitations under the License.
*/
package io.reactivex.rxjava3.core;
import java.util.*;
import java.util.concurrent.*;
import java.util.stream.*;
Reported by PMD.
Line: 116
* @since 2.0
* @see io.reactivex.rxjava3.observers.DisposableSingleObserver
*/
public abstract class Single<@NonNull T> implements SingleSource<T> {
/**
* Runs multiple {@link SingleSource}s and signals the events of the first one that signals (disposing
* the rest).
* <p>
Reported by PMD.
Line: 116
* @since 2.0
* @see io.reactivex.rxjava3.observers.DisposableSingleObserver
*/
public abstract class Single<@NonNull T> implements SingleSource<T> {
/**
* Runs multiple {@link SingleSource}s and signals the events of the first one that signals (disposing
* the rest).
* <p>
Reported by PMD.
Line: 116
* @since 2.0
* @see io.reactivex.rxjava3.observers.DisposableSingleObserver
*/
public abstract class Single<@NonNull T> implements SingleSource<T> {
/**
* Runs multiple {@link SingleSource}s and signals the events of the first one that signals (disposing
* the rest).
* <p>
Reported by PMD.
Line: 116
* @since 2.0
* @see io.reactivex.rxjava3.observers.DisposableSingleObserver
*/
public abstract class Single<@NonNull T> implements SingleSource<T> {
/**
* Runs multiple {@link SingleSource}s and signals the events of the first one that signals (disposing
* the rest).
* <p>
Reported by PMD.
Line: 138
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <@NonNull T> Single<T> amb(@NonNull Iterable<@NonNull ? extends SingleSource<? extends T>> sources) {
Objects.requireNonNull(sources, "sources is null");
return RxJavaPlugins.onAssembly(new SingleAmb<>(null, sources));
}
/**
* Runs multiple {@link SingleSource}s and signals the events of the first one that signals (disposing
Reported by PMD.
Line: 167
if (sources.length == 0) {
return error(SingleInternalHelper.emptyThrower());
}
if (sources.length == 1) {
@SuppressWarnings("unchecked")
SingleSource<T> source = (SingleSource<T>)sources[0];
return wrap(source);
}
return RxJavaPlugins.onAssembly(new SingleAmb<>(sources, null));
Reported by PMD.
Line: 168
return error(SingleInternalHelper.emptyThrower());
}
if (sources.length == 1) {
@SuppressWarnings("unchecked")
SingleSource<T> source = (SingleSource<T>)sources[0];
return wrap(source);
}
return RxJavaPlugins.onAssembly(new SingleAmb<>(sources, null));
}
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableMergeWithMaybeTest.java
89 issues
Line: 33
import io.reactivex.rxjava3.subjects.*;
import io.reactivex.rxjava3.testsupport.TestHelper;
public class ObservableMergeWithMaybeTest extends RxJavaTest {
@Test
public void normal() {
Observable.range(1, 5)
.mergeWith(Maybe.just(100))
Reported by PMD.
Line: 36
public class ObservableMergeWithMaybeTest extends RxJavaTest {
@Test
public void normal() {
Observable.range(1, 5)
.mergeWith(Maybe.just(100))
.test()
.assertResult(1, 2, 3, 4, 5, 100);
}
Reported by PMD.
Line: 37
@Test
public void normal() {
Observable.range(1, 5)
.mergeWith(Maybe.just(100))
.test()
.assertResult(1, 2, 3, 4, 5, 100);
}
Reported by PMD.
Line: 37
@Test
public void normal() {
Observable.range(1, 5)
.mergeWith(Maybe.just(100))
.test()
.assertResult(1, 2, 3, 4, 5, 100);
}
Reported by PMD.
Line: 37
@Test
public void normal() {
Observable.range(1, 5)
.mergeWith(Maybe.just(100))
.test()
.assertResult(1, 2, 3, 4, 5, 100);
}
Reported by PMD.
Line: 44
}
@Test
public void emptyOther() {
Observable.range(1, 5)
.mergeWith(Maybe.<Integer>empty())
.test()
.assertResult(1, 2, 3, 4, 5);
}
Reported by PMD.
Line: 45
@Test
public void emptyOther() {
Observable.range(1, 5)
.mergeWith(Maybe.<Integer>empty())
.test()
.assertResult(1, 2, 3, 4, 5);
}
Reported by PMD.
Line: 45
@Test
public void emptyOther() {
Observable.range(1, 5)
.mergeWith(Maybe.<Integer>empty())
.test()
.assertResult(1, 2, 3, 4, 5);
}
Reported by PMD.
Line: 45
@Test
public void emptyOther() {
Observable.range(1, 5)
.mergeWith(Maybe.<Integer>empty())
.test()
.assertResult(1, 2, 3, 4, 5);
}
Reported by PMD.
Line: 52
}
@Test
public void normalLong() {
Observable.range(1, 512)
.mergeWith(Maybe.just(100))
.test()
.assertValueCount(513)
.assertComplete();
Reported by PMD.
src/main/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupBy.java
89 issues
Line: 588
}
}
void cleanupQueue(long emitted, boolean polled) {
// if this group is canceled, all accumulated emissions and
// remaining items in the queue should be requested
// so that other groups can proceed
while (queue.poll() != null) {
emitted++;
Reported by PMD.
Line: 599
replenishParent(emitted, polled);
}
void replenishParent(long emitted, boolean polled) {
if (polled) {
emitted++;
}
if (emitted != 0L) {
requestParent(emitted);
Reported by PMD.
Line: 33
import io.reactivex.rxjava3.plugins.RxJavaPlugins;
public final class FlowableGroupBy<T, K, V> extends AbstractFlowableWithUpstream<T, GroupedFlowable<K, V>> {
final Function<? super T, ? extends K> keySelector;
final Function<? super T, ? extends V> valueSelector;
final int bufferSize;
final boolean delayError;
final Function<? super Consumer<Object>, ? extends Map<K, Object>> mapFactory;
Reported by PMD.
Line: 34
public final class FlowableGroupBy<T, K, V> extends AbstractFlowableWithUpstream<T, GroupedFlowable<K, V>> {
final Function<? super T, ? extends K> keySelector;
final Function<? super T, ? extends V> valueSelector;
final int bufferSize;
final boolean delayError;
final Function<? super Consumer<Object>, ? extends Map<K, Object>> mapFactory;
public FlowableGroupBy(Flowable<T> source, Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector,
Reported by PMD.
Line: 35
public final class FlowableGroupBy<T, K, V> extends AbstractFlowableWithUpstream<T, GroupedFlowable<K, V>> {
final Function<? super T, ? extends K> keySelector;
final Function<? super T, ? extends V> valueSelector;
final int bufferSize;
final boolean delayError;
final Function<? super Consumer<Object>, ? extends Map<K, Object>> mapFactory;
public FlowableGroupBy(Flowable<T> source, Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector,
int bufferSize, boolean delayError, Function<? super Consumer<Object>, ? extends Map<K, Object>> mapFactory) {
Reported by PMD.
Line: 36
final Function<? super T, ? extends K> keySelector;
final Function<? super T, ? extends V> valueSelector;
final int bufferSize;
final boolean delayError;
final Function<? super Consumer<Object>, ? extends Map<K, Object>> mapFactory;
public FlowableGroupBy(Flowable<T> source, Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector,
int bufferSize, boolean delayError, Function<? super Consumer<Object>, ? extends Map<K, Object>> mapFactory) {
super(source);
Reported by PMD.
Line: 37
final Function<? super T, ? extends V> valueSelector;
final int bufferSize;
final boolean delayError;
final Function<? super Consumer<Object>, ? extends Map<K, Object>> mapFactory;
public FlowableGroupBy(Flowable<T> source, Function<? super T, ? extends K> keySelector, Function<? super T, ? extends V> valueSelector,
int bufferSize, boolean delayError, Function<? super Consumer<Object>, ? extends Map<K, Object>> mapFactory) {
super(source);
this.keySelector = keySelector;
Reported by PMD.
Line: 65
Consumer<Object> evictionAction = (Consumer) new EvictionAction<>(evictedGroups);
groups = (Map) mapFactory.apply(evictionAction);
}
} catch (Throwable e) {
Exceptions.throwIfFatal(e);
s.onSubscribe(EmptyComponent.INSTANCE);
s.onError(e);
return;
}
Reported by PMD.
Line: 76
source.subscribe(subscriber);
}
public static final class GroupBySubscriber<T, K, V>
extends AtomicLong
implements FlowableSubscriber<T>, Subscription {
private static final long serialVersionUID = -3688291656102519502L;
Reported by PMD.
Line: 76
source.subscribe(subscriber);
}
public static final class GroupBySubscriber<T, K, V>
extends AtomicLong
implements FlowableSubscriber<T>, Subscription {
private static final long serialVersionUID = -3688291656102519502L;
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/maybe/MaybeBlockingSubscribeTest.java
87 issues
Line: 31
import io.reactivex.rxjava3.schedulers.Schedulers;
import io.reactivex.rxjava3.testsupport.TestHelper;
public class MaybeBlockingSubscribeTest {
@Test
public void noArgSuccess() {
Maybe.just(1)
.blockingSubscribe();
Reported by PMD.
Line: 34
public class MaybeBlockingSubscribeTest {
@Test
public void noArgSuccess() {
Maybe.just(1)
.blockingSubscribe();
}
@Test
Reported by PMD.
Line: 35
@Test
public void noArgSuccess() {
Maybe.just(1)
.blockingSubscribe();
}
@Test
public void noArgSuccessAsync() {
Reported by PMD.
Line: 40
}
@Test
public void noArgSuccessAsync() {
Maybe.just(1)
.delay(100, TimeUnit.MILLISECONDS)
.blockingSubscribe();
}
Reported by PMD.
Line: 41
@Test
public void noArgSuccessAsync() {
Maybe.just(1)
.delay(100, TimeUnit.MILLISECONDS)
.blockingSubscribe();
}
@Test
Reported by PMD.
Line: 41
@Test
public void noArgSuccessAsync() {
Maybe.just(1)
.delay(100, TimeUnit.MILLISECONDS)
.blockingSubscribe();
}
@Test
Reported by PMD.
Line: 47
}
@Test
public void noArgEmpty() {
Maybe.empty()
.blockingSubscribe();
}
@Test
Reported by PMD.
Line: 48
@Test
public void noArgEmpty() {
Maybe.empty()
.blockingSubscribe();
}
@Test
public void noArgEmptyAsync() {
Reported by PMD.
Line: 53
}
@Test
public void noArgEmptyAsync() {
Maybe.empty()
.delay(100, TimeUnit.MILLISECONDS)
.blockingSubscribe();
}
Reported by PMD.
Line: 54
@Test
public void noArgEmptyAsync() {
Maybe.empty()
.delay(100, TimeUnit.MILLISECONDS)
.blockingSubscribe();
}
@Test
Reported by PMD.
src/test/java/io/reactivex/rxjava3/internal/operators/observable/BlockingObservableNextTest.java
87 issues
Line: 301
assertFalse(it.hasNext());
System.out.println("a: " + a + " b: " + b + " c: " + c);
break;
} catch (AssertionError ex) {
if (++repeat == 3) {
throw ex;
}
Reported by PMD.
Line: 35
import io.reactivex.rxjava3.subjects.*;
import io.reactivex.rxjava3.testsupport.TestHelper;
public class BlockingObservableNextTest extends RxJavaTest {
private void fireOnNextInNewThread(final Subject<String> o, final String value) {
new Thread() {
@Override
public void run() {
Reported by PMD.
Line: 70
}
@Test
public void next() {
Subject<String> obs = PublishSubject.create();
Iterator<String> it = next(obs).iterator();
fireOnNextInNewThread(obs, "one");
assertTrue(it.hasNext());
assertEquals("one", it.next());
Reported by PMD.
Line: 72
@Test
public void next() {
Subject<String> obs = PublishSubject.create();
Iterator<String> it = next(obs).iterator();
fireOnNextInNewThread(obs, "one");
assertTrue(it.hasNext());
assertEquals("one", it.next());
fireOnNextInNewThread(obs, "two");
Reported by PMD.
Line: 73
public void next() {
Subject<String> obs = PublishSubject.create();
Iterator<String> it = next(obs).iterator();
fireOnNextInNewThread(obs, "one");
assertTrue(it.hasNext());
assertEquals("one", it.next());
fireOnNextInNewThread(obs, "two");
assertTrue(it.hasNext());
Reported by PMD.
Line: 77
assertTrue(it.hasNext());
assertEquals("one", it.next());
fireOnNextInNewThread(obs, "two");
assertTrue(it.hasNext());
assertEquals("two", it.next());
fireOnNextInNewThread(obs, "three");
try {
Reported by PMD.
Line: 88
fail("Calling next() without hasNext() should wait for next fire");
}
obs.onComplete();
assertFalse(it.hasNext());
try {
it.next();
fail("At the end of an iterator should throw a NoSuchElementException");
} catch (NoSuchElementException e) {
Reported by PMD.
Line: 92
assertFalse(it.hasNext());
try {
it.next();
fail("At the end of an iterator should throw a NoSuchElementException");
} catch (NoSuchElementException e) {
}
// If the Observable is completed, hasNext always returns false and next always throw a NoSuchElementException.
assertFalse(it.hasNext());
Reported by PMD.
Line: 93
try {
it.next();
fail("At the end of an iterator should throw a NoSuchElementException");
} catch (NoSuchElementException e) {
}
// If the Observable is completed, hasNext always returns false and next always throw a NoSuchElementException.
assertFalse(it.hasNext());
try {
Reported by PMD.
Line: 101
try {
it.next();
fail("At the end of an iterator should throw a NoSuchElementException");
} catch (NoSuchElementException e) {
}
}
@Test
public void nextWithError() {
Reported by PMD.