本文整理了Java中io.reactivex.subjects.Subject.hasThrowable()
方法的一些代码示例,展示了Subject.hasThrowable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Subject.hasThrowable()
方法的具体详情如下:
包路径:io.reactivex.subjects.Subject
类名称:Subject
方法名:hasThrowable
[英]Returns true if the subject has reached a terminal state through an error event.
The method is thread-safe.
[中]如果主题通过错误事件达到终端状态,则返回true。
该方法是线程安全的。
代码示例来源:origin: ReactiveX/RxJava
@Override
public boolean hasThrowable() {
return actual.hasThrowable();
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testPublishSubjectValueEmpty() {
PublishSubject<Integer> async = PublishSubject.create();
async.onComplete();
Subject<Integer> serial = async.toSerialized();
assertFalse(serial.hasObservers());
assertTrue(serial.hasComplete());
assertFalse(serial.hasThrowable());
assertNull(serial.getThrowable());
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testPublishSubjectValueRelay() {
PublishSubject<Integer> async = PublishSubject.create();
async.onNext(1);
async.onComplete();
Subject<Integer> serial = async.toSerialized();
assertFalse(serial.hasObservers());
assertTrue(serial.hasComplete());
assertFalse(serial.hasThrowable());
assertNull(serial.getThrowable());
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testPublishSubjectValueError() {
PublishSubject<Integer> async = PublishSubject.create();
TestException te = new TestException();
async.onError(te);
Subject<Integer> serial = async.toSerialized();
assertFalse(serial.hasObservers());
assertFalse(serial.hasComplete());
assertTrue(serial.hasThrowable());
assertSame(te, serial.getThrowable());
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testReplaySubjectValueRelayEmptyIncomplete() {
ReplaySubject<Integer> async = ReplaySubject.create();
Subject<Integer> serial = async.toSerialized();
assertFalse(serial.hasObservers());
assertFalse(serial.hasComplete());
assertFalse(serial.hasThrowable());
assertNull(serial.getThrowable());
assertNull(async.getValue());
assertFalse(async.hasValue());
assertArrayEquals(new Object[] { }, async.getValues());
assertArrayEquals(new Integer[] { }, async.getValues(new Integer[0]));
assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 }));
assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 }));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testReplaySubjectValueRelayBoundedEmptyIncomplete() {
ReplaySubject<Integer> async = ReplaySubject.createWithSize(1);
Subject<Integer> serial = async.toSerialized();
assertFalse(serial.hasObservers());
assertFalse(serial.hasComplete());
assertFalse(serial.hasThrowable());
assertNull(serial.getThrowable());
assertNull(async.getValue());
assertFalse(async.hasValue());
assertArrayEquals(new Object[] { }, async.getValues());
assertArrayEquals(new Integer[] { }, async.getValues(new Integer[0]));
assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 }));
assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 }));
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("deprecation")
@Test
public void testBehaviorSubjectIncompleteEmpty() {
BehaviorSubject<Integer> async = BehaviorSubject.create();
Subject<Integer> serial = async.toSerialized();
assertFalse(serial.hasObservers());
assertFalse(serial.hasComplete());
assertFalse(serial.hasThrowable());
assertNull(serial.getThrowable());
assertNull(async.getValue());
assertFalse(async.hasValue());
assertArrayEquals(new Object[] { }, async.getValues());
assertArrayEquals(new Integer[] { }, async.getValues(new Integer[0]));
assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 }));
assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 }));
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("deprecation")
@Test
public void testAsyncSubjectValueEmpty() {
AsyncSubject<Integer> async = AsyncSubject.create();
async.onComplete();
Subject<Integer> serial = async.toSerialized();
assertFalse(serial.hasObservers());
assertTrue(serial.hasComplete());
assertFalse(serial.hasThrowable());
assertNull(serial.getThrowable());
assertNull(async.getValue());
assertFalse(async.hasValue());
assertArrayEquals(new Object[] { }, async.getValues());
assertArrayEquals(new Integer[] { }, async.getValues(new Integer[0]));
assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 }));
assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 }));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testReplaySubjectBoundedEmpty() {
ReplaySubject<Integer> async = ReplaySubject.createWithSize(1);
async.onComplete();
Subject<Integer> serial = async.toSerialized();
assertFalse(serial.hasObservers());
assertTrue(serial.hasComplete());
assertFalse(serial.hasThrowable());
assertNull(serial.getThrowable());
assertNull(async.getValue());
assertFalse(async.hasValue());
assertArrayEquals(new Object[] { }, async.getValues());
assertArrayEquals(new Integer[] { }, async.getValues(new Integer[0]));
assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 }));
assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 }));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testReplaySubjectValueRelayIncomplete() {
ReplaySubject<Integer> async = ReplaySubject.create();
async.onNext(1);
Subject<Integer> serial = async.toSerialized();
assertFalse(serial.hasObservers());
assertFalse(serial.hasComplete());
assertFalse(serial.hasThrowable());
assertNull(serial.getThrowable());
assertEquals((Integer)1, async.getValue());
assertTrue(async.hasValue());
assertArrayEquals(new Object[] { 1 }, async.getValues());
assertArrayEquals(new Integer[] { 1 }, async.getValues(new Integer[0]));
assertArrayEquals(new Integer[] { 1 }, async.getValues(new Integer[] { 0 }));
assertArrayEquals(new Integer[] { 1, null }, async.getValues(new Integer[] { 0, 0 }));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testReplaySubjectEmpty() {
ReplaySubject<Integer> async = ReplaySubject.create();
async.onComplete();
Subject<Integer> serial = async.toSerialized();
assertFalse(serial.hasObservers());
assertTrue(serial.hasComplete());
assertFalse(serial.hasThrowable());
assertNull(serial.getThrowable());
assertNull(async.getValue());
assertFalse(async.hasValue());
assertArrayEquals(new Object[] { }, async.getValues());
assertArrayEquals(new Integer[] { }, async.getValues(new Integer[0]));
assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 }));
assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 }));
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("deprecation")
@Test
public void testBehaviorSubjectEmpty() {
BehaviorSubject<Integer> async = BehaviorSubject.create();
async.onComplete();
Subject<Integer> serial = async.toSerialized();
assertFalse(serial.hasObservers());
assertTrue(serial.hasComplete());
assertFalse(serial.hasThrowable());
assertNull(serial.getThrowable());
assertNull(async.getValue());
assertFalse(async.hasValue());
assertArrayEquals(new Object[] { }, async.getValues());
assertArrayEquals(new Integer[] { }, async.getValues(new Integer[0]));
assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 }));
assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 }));
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("deprecation")
@Test
public void testBehaviorSubjectValueRelayIncomplete() {
BehaviorSubject<Integer> async = BehaviorSubject.create();
async.onNext(1);
Subject<Integer> serial = async.toSerialized();
assertFalse(serial.hasObservers());
assertFalse(serial.hasComplete());
assertFalse(serial.hasThrowable());
assertNull(serial.getThrowable());
assertEquals((Integer)1, async.getValue());
assertTrue(async.hasValue());
assertArrayEquals(new Object[] { 1 }, async.getValues());
assertArrayEquals(new Integer[] { 1 }, async.getValues(new Integer[0]));
assertArrayEquals(new Integer[] { 1 }, async.getValues(new Integer[] { 0 }));
assertArrayEquals(new Integer[] { 1, null }, async.getValues(new Integer[] { 0, 0 }));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testReplaySubjectError() {
ReplaySubject<Integer> async = ReplaySubject.create();
TestException te = new TestException();
async.onError(te);
Subject<Integer> serial = async.toSerialized();
assertFalse(serial.hasObservers());
assertFalse(serial.hasComplete());
assertTrue(serial.hasThrowable());
assertSame(te, serial.getThrowable());
assertNull(async.getValue());
assertFalse(async.hasValue());
assertArrayEquals(new Object[] { }, async.getValues());
assertArrayEquals(new Integer[] { }, async.getValues(new Integer[0]));
assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 }));
assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 }));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testReplaySubjectBoundedError() {
ReplaySubject<Integer> async = ReplaySubject.createWithSize(1);
TestException te = new TestException();
async.onError(te);
Subject<Integer> serial = async.toSerialized();
assertFalse(serial.hasObservers());
assertFalse(serial.hasComplete());
assertTrue(serial.hasThrowable());
assertSame(te, serial.getThrowable());
assertNull(async.getValue());
assertFalse(async.hasValue());
assertArrayEquals(new Object[] { }, async.getValues());
assertArrayEquals(new Integer[] { }, async.getValues(new Integer[0]));
assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 }));
assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 }));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testReplaySubjectValueRelay() {
ReplaySubject<Integer> async = ReplaySubject.create();
async.onNext(1);
async.onComplete();
Subject<Integer> serial = async.toSerialized();
assertFalse(serial.hasObservers());
assertTrue(serial.hasComplete());
assertFalse(serial.hasThrowable());
assertNull(serial.getThrowable());
assertEquals((Integer)1, async.getValue());
assertTrue(async.hasValue());
assertArrayEquals(new Object[] { 1 }, async.getValues());
assertArrayEquals(new Integer[] { 1 }, async.getValues(new Integer[0]));
assertArrayEquals(new Integer[] { 1 }, async.getValues(new Integer[] { 0 }));
assertArrayEquals(new Integer[] { 1, null }, async.getValues(new Integer[] { 0, 0 }));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testReplaySubjectValueRelayBoundedIncomplete() {
ReplaySubject<Integer> async = ReplaySubject.createWithSize(1);
async.onNext(0);
async.onNext(1);
Subject<Integer> serial = async.toSerialized();
assertFalse(serial.hasObservers());
assertFalse(serial.hasComplete());
assertFalse(serial.hasThrowable());
assertNull(serial.getThrowable());
assertEquals((Integer)1, async.getValue());
assertTrue(async.hasValue());
assertArrayEquals(new Object[] { 1 }, async.getValues());
assertArrayEquals(new Integer[] { 1 }, async.getValues(new Integer[0]));
assertArrayEquals(new Integer[] { 1 }, async.getValues(new Integer[] { 0 }));
assertArrayEquals(new Integer[] { 1, null }, async.getValues(new Integer[] { 0, 0 }));
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("deprecation")
@Test
public void testBehaviorSubjectError() {
BehaviorSubject<Integer> async = BehaviorSubject.create();
TestException te = new TestException();
async.onError(te);
Subject<Integer> serial = async.toSerialized();
assertFalse(serial.hasObservers());
assertFalse(serial.hasComplete());
assertTrue(serial.hasThrowable());
assertSame(te, serial.getThrowable());
assertNull(async.getValue());
assertFalse(async.hasValue());
assertArrayEquals(new Object[] { }, async.getValues());
assertArrayEquals(new Integer[] { }, async.getValues(new Integer[0]));
assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 }));
assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 }));
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("deprecation")
@Test
public void testAsyncSubjectValueError() {
AsyncSubject<Integer> async = AsyncSubject.create();
TestException te = new TestException();
async.onError(te);
Subject<Integer> serial = async.toSerialized();
assertFalse(serial.hasObservers());
assertFalse(serial.hasComplete());
assertTrue(serial.hasThrowable());
assertSame(te, serial.getThrowable());
assertNull(async.getValue());
assertFalse(async.hasValue());
assertArrayEquals(new Object[] { }, async.getValues());
assertArrayEquals(new Integer[] { }, async.getValues(new Integer[0]));
assertArrayEquals(new Integer[] { null }, async.getValues(new Integer[] { 0 }));
assertArrayEquals(new Integer[] { null, 0 }, async.getValues(new Integer[] { 0, 0 }));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testReplaySubjectValueRelayBounded() {
ReplaySubject<Integer> async = ReplaySubject.createWithSize(1);
async.onNext(0);
async.onNext(1);
async.onComplete();
Subject<Integer> serial = async.toSerialized();
assertFalse(serial.hasObservers());
assertTrue(serial.hasComplete());
assertFalse(serial.hasThrowable());
assertNull(serial.getThrowable());
assertEquals((Integer)1, async.getValue());
assertTrue(async.hasValue());
assertArrayEquals(new Object[] { 1 }, async.getValues());
assertArrayEquals(new Integer[] { 1 }, async.getValues(new Integer[0]));
assertArrayEquals(new Integer[] { 1 }, async.getValues(new Integer[] { 0 }));
assertArrayEquals(new Integer[] { 1, null }, async.getValues(new Integer[] { 0, 0 }));
}
内容来源于网络,如有侵权,请联系作者删除!