@Override public String toString() { return super.toString()+" "+errors; } }
@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"; } } };
@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(); }
@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(); }
@Test public void interruptTestWaitStrategy() { try { Thread.currentThread().interrupt(); TestWaitStrategy.SLEEP_1000MS.run(); } catch (RuntimeException ex) { assertTrue(ex.toString(), ex.getCause() instanceof InterruptedException); } }
@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); } }
@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); } }
@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); } }
@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); } }
@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); } }
@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); } }
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; }
@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); } }
void method2(int i) { i++; this.i = i; method1(); try { this.method1(); } catch (RuntimeException e) { e.toString(); } this.i--; Integer.toString(10); }
@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); } }
@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)"); } } }
} catch (RuntimeException ex) { if (!(ex.getCause() instanceof IOException)) { fail(ex.toString() + ": Should have cause of IOException");
@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()); }
fail("Should have thrown"); } catch (RuntimeException ex) { assertTrue(ex.toString(), ex.getCause() instanceof InterruptedException);
fail(ex.toString() + " should have thrown RuntimeException(IOException)");