本文整理了Java中java.lang.Exception.<init>()
方法的一些代码示例,展示了Exception.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Exception.<init>()
方法的具体详情如下:
包路径:java.lang.Exception
类名称:Exception
方法名:<init>
[英]Constructs a new Exception that includes the current stack trace.
[中]构造包含当前堆栈跟踪的新异常。
代码示例来源:origin: ReactiveX/RxJava
@Override
public Object apply(Long aLong) throws Exception {
throw new Exception();
}
});
代码示例来源:origin: ReactiveX/RxJava
@Override
public Object apply(Long aLong) throws Exception {
throw new Exception();
}
});
代码示例来源:origin: google/guava
private static boolean hasConstructorUsableByGetChecked(
Class<? extends Exception> exceptionClass) {
try {
Exception unused = newWithCause(exceptionClass, new Exception());
return true;
} catch (Exception e) {
return false;
}
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public Publisher<Integer> apply(Long aLong) throws Exception {
return Flowable.error(new Exception());
}
});
代码示例来源:origin: ReactiveX/RxJava
@Override
public ObservableSource<Integer> apply(Long aLong) throws Exception {
return Observable.error(new Exception());
}
});
代码示例来源:origin: google/guava
public void testGetCasualChainLoop() {
Exception cause = new Exception();
Exception exception = new Exception(cause);
cause.initCause(exception);
try {
Throwables.getCausalChain(cause);
fail("Should have throw IAE");
} catch (IllegalArgumentException expected) {
assertThat(expected).hasCauseThat().isSameAs(cause);
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testErrorPassThru() {
Exception exception = new Exception("test");
Observable<Integer> o = Observable.error(exception);
Observable<Integer> dematerialize = o.dematerialize();
Observer<Integer> observer = TestHelper.mockObserver();
dematerialize.subscribe(observer);
verify(observer, times(1)).onError(exception);
verify(observer, times(0)).onComplete();
verify(observer, times(0)).onNext(any(Integer.class));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testSkipError() {
Exception e = new Exception();
Observable<String> ok = Observable.just("one");
Observable<String> error = Observable.error(e);
Observable<String> skip = Observable.concat(ok, error).skip(100);
Observer<String> observer = TestHelper.mockObserver();
skip.subscribe(observer);
verify(observer, never()).onNext(any(String.class));
verify(observer, times(1)).onError(e);
verify(observer, never()).onComplete();
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testDematerialize3() {
Exception exception = new Exception("test");
Observable<Integer> o = Observable.error(exception);
Observable<Integer> dematerialize = o.materialize().dematerialize();
Observer<Integer> observer = TestHelper.mockObserver();
dematerialize.subscribe(observer);
verify(observer, times(1)).onError(exception);
verify(observer, times(0)).onComplete();
verify(observer, times(0)).onNext(any(Integer.class));
}
代码示例来源:origin: google/guava
public void testCatching_rejectionPropagatesToOutput() throws Exception {
SettableFuture<String> input = SettableFuture.create();
ListenableFuture<String> transformed =
catching(input, Throwable.class, constant("foo"), REJECTING_EXECUTOR);
input.setException(new Exception());
try {
getDone(transformed);
fail();
} catch (ExecutionException expected) {
assertThat(expected.getCause()).isInstanceOf(RejectedExecutionException.class);
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testOnErrorIntegerNotificationWhenNotEqual() {
final Notification<Integer> onErrorNotification = Notification.createOnError(new Exception());
final Notification<Integer> onErrorNotification2 = Notification.createOnError(new Exception());
Assert.assertFalse(onErrorNotification.equals(onErrorNotification2));
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testErrorPassThru() {
Exception exception = new Exception("test");
Flowable<Integer> flowable = Flowable.error(exception);
Flowable<Integer> dematerialize = flowable.dematerialize();
Subscriber<Integer> subscriber = TestHelper.mockSubscriber();
dematerialize.subscribe(subscriber);
verify(subscriber, times(1)).onError(exception);
verify(subscriber, times(0)).onComplete();
verify(subscriber, times(0)).onNext(any(Integer.class));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testDematerialize3() {
Exception exception = new Exception("test");
Flowable<Integer> flowable = Flowable.error(exception);
Flowable<Integer> dematerialize = flowable.materialize().dematerialize();
Subscriber<Integer> subscriber = TestHelper.mockSubscriber();
dematerialize.subscribe(subscriber);
verify(subscriber, times(1)).onError(exception);
verify(subscriber, times(0)).onComplete();
verify(subscriber, times(0)).onNext(any(Integer.class));
}
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = NullPointerException.class)
public void testForEachWithNull() {
Flowable.error(new Exception("boo"))
//
.forEach(null);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testSkipError() {
Exception e = new Exception();
Flowable<String> ok = Flowable.just("one");
Flowable<String> error = Flowable.error(e);
Flowable<String> skip = Flowable.concat(ok, error).skip(100);
Subscriber<String> subscriber = TestHelper.mockSubscriber();
skip.subscribe(subscriber);
verify(subscriber, never()).onNext(any(String.class));
verify(subscriber, times(1)).onError(e);
verify(subscriber, never()).onComplete();
}
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = NullPointerException.class)
public void testForEachWithNull() {
Observable.error(new Exception("boo"))
//
.forEach(null);
}
代码示例来源:origin: google/guava
public void testSetFailureNull() throws Exception {
try {
future.setException(null);
fail();
} catch (NullPointerException expected) {
}
assertFalse(future.isDone());
assertTrue(future.setException(new Exception("failure")));
tester.testFailedFuture("failure");
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testOnErrorIntegerNotificationsWhenEqual() {
final Exception exception = new Exception();
final Notification<Integer> onErrorNotification = Notification.createOnError(exception);
final Notification<Integer> onErrorNotification2 = Notification.createOnError(exception);
Assert.assertTrue(onErrorNotification.equals(onErrorNotification2));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
@Ignore("Nulls are not allowed")
public void testOnErrorIntegerNotificationDoesNotEqualNullNotification() {
final Notification<Integer> integerNotification = Notification.createOnError(new Exception());
final Notification<Integer> nullNotification = Notification.createOnError(null);
Assert.assertFalse(integerNotification.equals(nullNotification));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
@Ignore("Nulls are not allowed")
public void testOnErrorNullNotificationDoesNotEqualIntegerNotification() {
final Notification<Integer> integerNotification = Notification.createOnError(new Exception());
final Notification<Integer> nullNotification = Notification.createOnError(null);
Assert.assertFalse(nullNotification.equals(integerNotification));
}
内容来源于网络,如有侵权,请联系作者删除!