Skip to content

Instantly share code, notes, and snippets.

@deepakazad
Created July 5, 2017 06:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deepakazad/ba4436b22d4b7a0f515d2dce294e094b to your computer and use it in GitHub Desktop.
Save deepakazad/ba4436b22d4b7a0f515d2dce294e094b to your computer and use it in GitHub Desktop.
public final class RxJavaExceptionTesting {
public Observable<String> foo1() {
return Observable.empty();
}
public Observable<String> foo2() {
return Observable.error(new MyException());
}
public Observable<String> foo3() {
return Observable.error(new MyException("This is a custom exception."));
}
}
class MyException extends Exception {
private String message;
public MyException() {
super();
this.message ="";
}
public MyException(String message) {
super(message);
this.message = message;
}
@Override
public boolean equals(final Object obj) {
return obj != null
&& obj instanceof MyException
&& Objects.equals(message, ((MyException) obj).message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment