@Test
public void fromActionThrows() {

    try {
        Disposables.fromAction(new Action() {
            @Override
            public void run() throws Exception {
                throw new IllegalArgumentException();
            }
        }).dispose();
        fail("Should have thrown!");
    } catch (IllegalArgumentException ex) {
        // expected
    }
    try {
        Disposables.fromAction(new Action() {
            @Override
            public void run() throws Exception {
                throw new InternalError();
            }
        }).dispose();
        fail("Should have thrown!");
    } catch (InternalError ex) {
        // expected
    }
    try {
        Disposables.fromAction(new Action() {
            @Override
            public void run() throws Exception {
                throw new IOException();
            }
        }).dispose();
        fail("Should have thrown!");
    } catch (RuntimeException ex) {
        if (!(ex.getCause() instanceof IOException)) {
            fail(ex.toString() + ": Should have cause of IOException");
        }
        // expected
    }
}