java.lang.RuntimeException.toString()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(171)

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

RuntimeException.toString介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

@Override
  public String toString() {
    return super.toString()+" "+errors;
  }
}

代码示例来源:origin: facebook/stetho

@Override
 public Object evaluate(String expression) throws Exception {
  if (mRhinoJsUnexpectedError != null) {
   return "stetho-js-rhino threw: " + mRhinoJsUnexpectedError.toString();
  } else {
   return "Not supported without stetho-js-rhino dependency";
  }
 }
};

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

@Test
public void interrupted() {
  Iterator<Object> it = Flowable.never().blockingLatest().iterator();
  Thread.currentThread().interrupt();
  try {
    it.hasNext();
  } catch (RuntimeException ex) {
    assertTrue(ex.toString(), ex.getCause() instanceof InterruptedException);
  }
  Thread.interrupted();
}

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

@Test
public void interrupted() {
  Iterator<Object> it = Observable.never().blockingLatest().iterator();
  Thread.currentThread().interrupt();
  try {
    it.hasNext();
  } catch (RuntimeException ex) {
    assertTrue(ex.toString(), ex.getCause() instanceof InterruptedException);
  }
  Thread.interrupted();
}

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

@Test
public void interruptTestWaitStrategy() {
  try {
    Thread.currentThread().interrupt();
    TestWaitStrategy.SLEEP_1000MS.run();
  } catch (RuntimeException ex) {
    assertTrue(ex.toString(), ex.getCause() instanceof InterruptedException);
  }
}

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

@Test
public void interrupt() {
  Iterator<Object> it = Observable.never().blockingNext().iterator();
  try {
    Thread.currentThread().interrupt();
    it.next();
  } catch (RuntimeException ex) {
    assertTrue(ex.toString(), ex.getCause() instanceof InterruptedException);
  }
}

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

@Test
public void interrupt() {
  Iterator<Object> it = Flowable.never().blockingNext().iterator();
  try {
    Thread.currentThread().interrupt();
    it.next();
  } catch (RuntimeException ex) {
    assertTrue(ex.toString(), ex.getCause() instanceof InterruptedException);
  }
}

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

@Test
public void interruptWait() {
  BlockingFlowableIterator<Integer> it = new BlockingFlowableIterator<Integer>(128);
  try {
    Thread.currentThread().interrupt();
    it.hasNext();
  } catch (RuntimeException ex) {
    assertTrue(ex.toString(), ex.getCause() instanceof InterruptedException);
  }
}

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

@Test
public void awaitDoneTimed() {
  TestObserver<Integer> to = new TestObserver<Integer>();
  Thread.currentThread().interrupt();
  try {
    to.awaitDone(5, TimeUnit.SECONDS);
  } catch (RuntimeException ex) {
    assertTrue(ex.toString(), ex.getCause() instanceof InterruptedException);
  }
}

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

@Test
public void interruptWait() {
  BlockingObservableIterator<Integer> it = new BlockingObservableIterator<Integer>(128);
  try {
    Thread.currentThread().interrupt();
    it.hasNext();
  } catch (RuntimeException ex) {
    assertTrue(ex.toString(), ex.getCause() instanceof InterruptedException);
  }
}

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

@Test
public void awaitDoneTimed() {
  TestSubscriber<Integer> ts = new TestSubscriber<Integer>();
  Thread.currentThread().interrupt();
  try {
    ts.awaitDone(5, TimeUnit.SECONDS);
  } catch (RuntimeException ex) {
    assertTrue(ex.toString(), ex.getCause() instanceof InterruptedException);
  }
}

代码示例来源:origin: apache/zookeeper

public static List<HostPort> parseHostPortList(String hplist) {
  ArrayList<HostPort> alist = new ArrayList<HostPort>();
  for (String hp: hplist.split(",")) {
    int idx = hp.lastIndexOf(':');
    String host = hp.substring(0, idx);
    int port;
    try {
      port = Integer.parseInt(hp.substring(idx + 1));
    } catch(RuntimeException e) {
      throw new RuntimeException("Problem parsing " + hp + e.toString());
    }
    alist.add(new HostPort(host,port));
  }
  return alist;
}

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

@Test(timeout = 5000)
public void blockingFirstTimeout() {
  BlockingFirstSubscriber<Integer> bf = new BlockingFirstSubscriber<Integer>();
  Thread.currentThread().interrupt();
  try {
    bf.blockingGet();
    fail("Should have thrown!");
  } catch (RuntimeException ex) {
    assertTrue(ex.toString(), ex.getCause() instanceof InterruptedException);
  }
}

代码示例来源:origin: checkstyle/checkstyle

void method2(int i) {
  i++;
  this.i = i;
  method1();
  try {
    this.method1();
  }
  catch (RuntimeException e) {
    e.toString();
  }
  this.i--;
  Integer.toString(10);
}

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

@Test(timeout = 5000)
public void blockingFirstTimeout2() {
  BlockingFirstSubscriber<Integer> bf = new BlockingFirstSubscriber<Integer>();
  bf.onSubscribe(new BooleanSubscription());
  Thread.currentThread().interrupt();
  try {
    bf.blockingGet();
    fail("Should have thrown!");
  } catch (RuntimeException ex) {
    assertTrue(ex.toString(), ex.getCause() instanceof InterruptedException);
  }
}

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

@Test
public void manualPropagate() {
  try {
    Exceptions.propagate(new InternalError());
    fail("Didn't throw exception");
  } catch (InternalError ex) {
    // expected
  }
  try {
    throw Exceptions.propagate(new IllegalArgumentException());
  } catch (IllegalArgumentException ex) {
    // expected
  }
  try {
    throw ExceptionHelper.wrapOrThrow(new IOException());
  } catch (RuntimeException ex) {
    if (!(ex.getCause() instanceof IOException)) {
      fail(ex.toString() + ": should have thrown RuntimeException(IOException)");
    }
  }
}

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

} catch (RuntimeException ex) {
  if (!(ex.getCause() instanceof IOException)) {
    fail(ex.toString() + ": Should have cause of IOException");

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

@Test
public void disposeThrowsCheckedException() {
  CompositeDisposable cd = new CompositeDisposable();
  cd.add(Disposables.fromAction(new Action() {
    @Override
    public void run() throws Exception {
      throw new IOException();
    }
  }));
  Disposable d1 = Disposables.empty();
  cd.add(d1);
  try {
    cd.dispose();
    fail("Failed to throw");
  } catch (RuntimeException ex) {
    // expected
    if (!(ex.getCause() instanceof IOException)) {
      fail(ex.toString() + " should have thrown RuntimeException(IOException)");
    }
  }
  assertTrue(d1.isDisposed());
}

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

fail("Should have thrown");
} catch (RuntimeException ex) {
  assertTrue(ex.toString(), ex.getCause() instanceof InterruptedException);

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

fail(ex.toString() + " should have thrown RuntimeException(IOException)");

相关文章