java.lang.AssertionError.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(221)

本文整理了Java中java.lang.AssertionError.<init>()方法的一些代码示例,展示了AssertionError.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AssertionError.<init>()方法的具体详情如下:
包路径:java.lang.AssertionError
类名称:AssertionError
方法名:<init>

AssertionError.<init>介绍

[英]Constructs a new AssertionError with no message.
[中]构造一个没有消息的新AssertionError。

代码示例

代码示例来源:origin: ReactiveX/RxJava

/**
 * Assert that the upstream is a fuseable source.
 * <p>Package-private: avoid leaking the now internal fusion properties into the public API.
 * Use ObserverFusion to work with such tests.
 * @return this
 */
final TestObserver<T> assertFuseable() {
  if (qd == null) {
    throw new AssertionError("Upstream is not fuseable.");
  }
  return this;
}

代码示例来源:origin: ReactiveX/RxJava

/**
 * Assert that the upstream is not a fuseable source.
 * <p>Package-private: avoid leaking the now internal fusion properties into the public API.
 * Use ObserverFusion to work with such tests.
 * @return this
 */
final TestObserver<T> assertNotFuseable() {
  if (qd != null) {
    throw new AssertionError("Upstream is fuseable.");
  }
  return this;
}

代码示例来源:origin: ReactiveX/RxJava

/**
 * Assert that the upstream is a fuseable source.
 * <p>Package-private: avoid leaking the now internal fusion properties into the public API.
 * Use SubscriberFusion to work with such tests.
 * @return this
 */
final TestSubscriber<T> assertFuseable() {
  if (qs == null) {
    throw new AssertionError("Upstream is not fuseable.");
  }
  return this;
}

代码示例来源:origin: ReactiveX/RxJava

/**
 * Assert that the upstream is not a fuseable source.
 * <p>Package-private: avoid leaking the now internal fusion properties into the public API.
 * Use SubscriberFusion to work with such tests.
 * @return this
 */
final TestSubscriber<T> assertNotFuseable() {
  if (qs != null) {
    throw new AssertionError("Upstream is fuseable.");
  }
  return this;
}

代码示例来源:origin: square/retrofit

FakeCall(@Nullable Response<T> response, @Nullable Throwable error) {
 if ((response == null) == (error == null)) {
  throw new AssertionError("Only one of response or error can be set.");
 }
 this.response = response;
 this.error = error;
}

代码示例来源:origin: ReactiveX/RxJava

@Override
  public Scheduler call() throws Exception {
    throw new AssertionError("Default Scheduler instance should not have been evaluated");
  }
};

代码示例来源:origin: ReactiveX/RxJava

@Override
  public void run() throws Exception {
    throw new AssertionError();
  }
}));

代码示例来源:origin: square/retrofit

@Override List<? extends CallAdapter.Factory> defaultCallAdapterFactories(
  @Nullable Executor callbackExecutor) {
 if (callbackExecutor == null) throw new AssertionError();
 ExecutorCallAdapterFactory executorFactory = new ExecutorCallAdapterFactory(callbackExecutor);
 return Build.VERSION.SDK_INT >= 24
  ? asList(CompletableFutureCallAdapterFactory.INSTANCE, executorFactory)
  : singletonList(executorFactory);
}

代码示例来源:origin: square/okhttp

private <T> void finished(Deque<T> calls, T call) {
 Runnable idleCallback;
 synchronized (this) {
  if (!calls.remove(call)) throw new AssertionError("Call wasn't in-flight!");
  idleCallback = this.idleCallback;
 }
 boolean isRunning = promoteAndExecute();
 if (!isRunning && idleCallback != null) {
  idleCallback.run();
 }
}

代码示例来源:origin: square/okhttp

private static SSLSocketFactory createInsecureSslSocketFactory(TrustManager trustManager) {
 try {
  SSLContext context = Platform.get().getSSLContext();
  context.init(null, new TrustManager[] {trustManager}, null);
  return context.getSocketFactory();
 } catch (Exception e) {
  throw new AssertionError(e);
 }
}

代码示例来源:origin: square/okhttp

private static SSLSocketFactory newSslSocketFactory(X509TrustManager trustManager) {
 try {
  SSLContext sslContext = Platform.get().getSSLContext();
  sslContext.init(null, new TrustManager[] { trustManager }, null);
  return sslContext.getSocketFactory();
 } catch (GeneralSecurityException e) {
  throw new AssertionError("No System TLS", e); // The system has no TLS. Just give up.
 }
}

代码示例来源:origin: ReactiveX/RxJava

public CrashDummy assertError(Class<? extends Throwable> clazz) {
  if (!clazz.isInstance(error)) {
    throw new AssertionError("Different error: " + error);
  }
  return this;
}

代码示例来源:origin: ReactiveX/RxJava

public CrashDummy assertError(Class<? extends Throwable> clazz) {
  if (!clazz.isInstance(error)) {
    throw new AssertionError("Different error: " + error);
  }
  return this;
}

代码示例来源:origin: ReactiveX/RxJava

ParamOverride(Class<?> clazz, int index, ParamMode mode, String name, Class<?>... arguments) {
  this.clazz = clazz;
  this.index = index;
  this.mode = mode;
  this.name = name;
  this.arguments = arguments;
  try {
    clazz.getMethod(name, arguments);
  } catch (Exception ex) {
    throw new AssertionError(ex);
  }
}

代码示例来源:origin: ReactiveX/RxJava

public static void assertError(List<Throwable> list, int index, Class<? extends Throwable> clazz) {
  Throwable ex = list.get(index);
  if (!clazz.isInstance(ex)) {
    AssertionError err = new AssertionError(clazz + " expected but got " + list.get(index));
    err.initCause(list.get(index));
    throw err;
  }
}

代码示例来源:origin: square/retrofit

@Override public void onError(Throwable throwable) {
 if (!subscriberTerminated) {
  subscriber.onError(throwable);
 } else {
  // This should never happen! onNext handles and forwards errors automatically.
  Throwable broken = new AssertionError(
    "This should never happen! Report as a Retrofit bug with the full stacktrace.");
  //noinspection UnnecessaryInitCause Two-arg AssertionError constructor is 1.7+ only.
  broken.initCause(throwable);
  RxJavaPlugins.getInstance().getErrorHandler().handleError(broken);
 }
}

代码示例来源:origin: square/okhttp

private ByteString pkcs1Bytes() {
 try {
  PrivateKeyInfo privateKeyInfo = PrivateKeyInfo.getInstance(keyPair.getPrivate().getEncoded());
  return ByteString.of(privateKeyInfo.parsePrivateKey().toASN1Primitive().getEncoded());
 } catch (IOException e) {
  throw new AssertionError(e);
 }
}

代码示例来源:origin: ReactiveX/RxJava

@Test//(timeout = 20000)
public void testSimpleAsyncLoop() {
  IoScheduler ios = (IoScheduler)Schedulers.io();
  int c = ios.size();
  for (int i = 0; i < 200; i++) {
    testSimpleAsync();
    int c1 = ios.size();
    if (c + 60 < c1) {
      throw new AssertionError("Worker leak: " + c + " - " + c1);
    }
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Test//(timeout = 20000)
public void testSimpleAsyncLoop() {
  IoScheduler ios = (IoScheduler)Schedulers.io();
  int c = ios.size();
  for (int i = 0; i < 200; i++) {
    testSimpleAsync();
    int c1 = ios.size();
    if (c + 60 < c1) {
      throw new AssertionError("Worker leak: " + c + " - " + c1);
    }
  }
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void onExceptionResumeNextPassthrough() {
  Maybe.error(new AssertionError())
  .onExceptionResumeNext(Maybe.just(1))
  .test()
  .assertFailure(AssertionError.class);
}

相关文章